Compare commits
8 commits
Author | SHA1 | Date | |
---|---|---|---|
|
c76d8aa0b5 | ||
|
9518ea9acc | ||
|
30d1b37a56 | ||
|
26ceba0e47 | ||
|
3b7eb6a140 | ||
|
3530aa6861 | ||
|
3c6af5f68d | ||
|
277313b58d |
17 changed files with 56 additions and 21 deletions
|
@ -15,6 +15,6 @@ call ale#linter#Define('dart', {
|
||||||
\ 'name': 'language_server',
|
\ 'name': 'language_server',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': ale#VarFunc('dart_language_server_executable'),
|
\ 'executable_callback': ale#VarFunc('dart_language_server_executable'),
|
||||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
\ 'command': '%e',
|
||||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -23,7 +23,7 @@ call ale#linter#Define('kotlin', {
|
||||||
\ 'name': 'languageserver',
|
\ 'name': 'languageserver',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': ale#VarFunc('kotlin_languageserver_executable'),
|
\ 'executable_callback': ale#VarFunc('kotlin_languageserver_executable'),
|
||||||
\ 'command_callback': '%e',
|
\ 'command': '%e',
|
||||||
\ 'language': 'kotlin',
|
\ 'language': 'kotlin',
|
||||||
\ 'project_root_callback': 'ale_linters#kotlin#languageserver#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#kotlin#languageserver#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -8,10 +8,12 @@ function! ale_linters#nasm#nasm#GetCommand(buffer) abort
|
||||||
" Note that NASM requires a trailing slash for the -I option.
|
" Note that NASM requires a trailing slash for the -I option.
|
||||||
let l:separator = has('win32') ? '\' : '/'
|
let l:separator = has('win32') ? '\' : '/'
|
||||||
let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
|
let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
|
||||||
|
let l:output_null = has('win32') ? 'NUL' : '/dev/null'
|
||||||
|
|
||||||
return '%e -X gnu -I ' . ale#Escape(l:path)
|
return '%e -X gnu -I ' . ale#Escape(l:path)
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
|
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
|
||||||
\ . ' %s'
|
\ . ' %s'
|
||||||
|
\ . ' -o ' . l:output_null
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
|
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
|
||||||
|
|
|
@ -14,6 +14,10 @@ let s:begin_failed_skip_pattern = '\v' . join([
|
||||||
\], '|')
|
\], '|')
|
||||||
|
|
||||||
function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
||||||
|
if empty(a:lines)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
let l:basename = expand('#' . a:buffer . ':t')
|
let l:basename = expand('#' . a:buffer . ':t')
|
||||||
|
|
|
@ -49,7 +49,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
|
||||||
for l:item in l:result
|
for l:item in l:result
|
||||||
let l:filename = ale#path#FromURI(l:item.uri)
|
let l:filename = ale#path#FromURI(l:item.uri)
|
||||||
let l:line = l:item.range.start.line + 1
|
let l:line = l:item.range.start.line + 1
|
||||||
let l:column = l:item.range.start.character
|
let l:column = l:item.range.start.character + 1
|
||||||
|
|
||||||
call ale#util#Open(l:filename, l:line, l:column, l:options)
|
call ale#util#Open(l:filename, l:line, l:column, l:options)
|
||||||
break
|
break
|
||||||
|
|
|
@ -243,7 +243,7 @@ endfunction
|
||||||
" (name, func, filetypes, desc, aliases)
|
" (name, func, filetypes, desc, aliases)
|
||||||
function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
|
function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
|
||||||
" This command will throw from the sandbox.
|
" This command will throw from the sandbox.
|
||||||
let &equalprg=&equalprg
|
let &l:equalprg=&l:equalprg
|
||||||
|
|
||||||
if type(a:name) isnot v:t_string
|
if type(a:name) isnot v:t_string
|
||||||
throw '''name'' must be a String'
|
throw '''name'' must be a String'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
" Author: Jeff Willette <jrwillette88@gmail.com>
|
||||||
" Description: Integration of importjs with ALE.
|
" Description: Integration of importjs with ALE.
|
||||||
|
|
||||||
call ale#Set('js_importjs_executable', 'importjs')
|
call ale#Set('javascript_importjs_executable', 'importjs')
|
||||||
|
|
||||||
function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
|
function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
|
||||||
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
|
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
|
||||||
|
@ -9,7 +9,7 @@ function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#fixers#importjs#Fix(buffer) abort
|
function! ale#fixers#importjs#Fix(buffer) abort
|
||||||
let l:executable = ale#Var(a:buffer, 'js_importjs_executable')
|
let l:executable = ale#Var(a:buffer, 'javascript_importjs_executable')
|
||||||
|
|
||||||
if !executable(l:executable)
|
if !executable(l:executable)
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -53,7 +53,7 @@ endfunction
|
||||||
" Do not call this function.
|
" Do not call this function.
|
||||||
function! ale#linter#GetLintersLoaded() abort
|
function! ale#linter#GetLintersLoaded() abort
|
||||||
" This command will throw from the sandbox.
|
" This command will throw from the sandbox.
|
||||||
let &equalprg=&equalprg
|
let &l:equalprg=&l:equalprg
|
||||||
|
|
||||||
return s:linters
|
return s:linters
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -295,7 +295,7 @@ endfunction
|
||||||
|
|
||||||
function! ale#linter#Define(filetype, linter) abort
|
function! ale#linter#Define(filetype, linter) abort
|
||||||
" This command will throw from the sandbox.
|
" This command will throw from the sandbox.
|
||||||
let &equalprg=&equalprg
|
let &l:equalprg=&l:equalprg
|
||||||
|
|
||||||
if !has_key(s:linters, a:filetype)
|
if !has_key(s:linters, a:filetype)
|
||||||
let s:linters[a:filetype] = []
|
let s:linters[a:filetype] = []
|
||||||
|
|
|
@ -256,7 +256,8 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get(a:response, 'method', '') is# ''
|
if get(a:response, 'method', '') is# ''
|
||||||
if has_key(get(a:response, 'result', {}), 'capabilities')
|
if type(get(a:response, 'result')) is v:t_dict
|
||||||
|
\&& has_key(a:response.result, 'capabilities')
|
||||||
call s:UpdateCapabilities(a:conn, a:response.result.capabilities)
|
call s:UpdateCapabilities(a:conn, a:response.result.capabilities)
|
||||||
|
|
||||||
for [l:dir, l:project] in l:uninitialized_projects
|
for [l:dir, l:project] in l:uninitialized_projects
|
||||||
|
|
|
@ -268,7 +268,7 @@ endfunction
|
||||||
" See :help sandbox
|
" See :help sandbox
|
||||||
function! ale#util#InSandbox() abort
|
function! ale#util#InSandbox() abort
|
||||||
try
|
try
|
||||||
let &equalprg=&equalprg
|
let &l:equalprg=&l:equalprg
|
||||||
catch /E48/
|
catch /E48/
|
||||||
" E48 is the sandbox error.
|
" E48 is the sandbox error.
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('dart', 'language_server')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'dart_language_server', ale#Escape('dart_language_server')
|
|
@ -0,0 +1,8 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('kotlin', 'languageserver')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'kotlin-language-server', ale#Escape('kotlin-language-server')
|
|
@ -2,9 +2,9 @@ Before:
|
||||||
call ale#assert#SetUpLinterTest('nasm', 'nasm')
|
call ale#assert#SetUpLinterTest('nasm', 'nasm')
|
||||||
|
|
||||||
let b:command_tail =
|
let b:command_tail =
|
||||||
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s'
|
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||||
let b:command_tail_opt =
|
let b:command_tail_opt =
|
||||||
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s'
|
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
unlet! b:command_tail
|
unlet! b:command_tail
|
||||||
|
@ -23,7 +23,7 @@ Execute(The options should be configurable):
|
||||||
let b:ale_nasm_nasm_options = '-w-macro-params'
|
let b:ale_nasm_nasm_options = '-w-macro-params'
|
||||||
|
|
||||||
AssertLinter 'nasm', ale#Escape('nasm')
|
AssertLinter 'nasm', ale#Escape('nasm')
|
||||||
\ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s'
|
\ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||||
|
|
||||||
Execute(The options should be used in command):
|
Execute(The options should be used in command):
|
||||||
let b:ale_nasm_nasm_options = '-w+orphan-labels'
|
let b:ale_nasm_nasm_options = '-w+orphan-labels'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Before:
|
Before:
|
||||||
Save g:ale_js_importjs_executable
|
Save g:ale_javascript_importjs_executable
|
||||||
|
|
||||||
" Use an invalid global executable, so we don't match it.
|
" Use an invalid global executable, so we don't match it.
|
||||||
let g:ale_js_importjs_executable = 'xxxinvalid'
|
let g:ale_javascript_importjs_executable = 'xxxinvalid'
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
call ale#test#SetFilename('../javascript_files/test.js')
|
call ale#test#SetFilename('../javascript_files/test.js')
|
||||||
|
@ -18,12 +18,12 @@ Execute(The importjs callback should return 0 when the executable isn't executab
|
||||||
\ ale#fixers#importjs#Fix(bufnr(''))
|
\ ale#fixers#importjs#Fix(bufnr(''))
|
||||||
|
|
||||||
Execute(The importjs callback should run the command when the executable test passes):
|
Execute(The importjs callback should run the command when the executable test passes):
|
||||||
let g:ale_js_importjs_executable = has('win32') ? 'cmd' : 'echo'
|
let g:ale_javascript_importjs_executable = has('win32') ? 'cmd' : 'echo'
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'process_with': 'ale#fixers#importjs#ProcessOutput',
|
\ 'process_with': 'ale#fixers#importjs#ProcessOutput',
|
||||||
\ 'command': ale#Escape(g:ale_js_importjs_executable) . ' fix %s'
|
\ 'command': ale#Escape(g:ale_javascript_importjs_executable) . ' fix %s'
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#importjs#Fix(bufnr(''))
|
\ ale#fixers#importjs#Fix(bufnr(''))
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,11 @@ After:
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
call ale#linter#Reset()
|
call ale#linter#Reset()
|
||||||
|
|
||||||
|
Execute(The Perl linter should handle empty output):
|
||||||
|
call ale#test#SetFilename('bar.pl')
|
||||||
|
|
||||||
|
AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), [])
|
||||||
|
|
||||||
Execute(The Perl linter should ignore errors from other files):
|
Execute(The Perl linter should ignore errors from other files):
|
||||||
call ale#test#SetFilename('bar.pl')
|
call ale#test#SetFilename('bar.pl')
|
||||||
|
|
||||||
|
|
|
@ -181,3 +181,10 @@ Execute(Disabled capabilities should be recognised correctly):
|
||||||
\ },
|
\ },
|
||||||
\ },
|
\ },
|
||||||
\ b:conn
|
\ b:conn
|
||||||
|
|
||||||
|
Execute(Results that are not dictionaries should be handled correctly):
|
||||||
|
call ale#lsp#HandleOtherInitializeResponses(b:conn, {
|
||||||
|
\ 'jsonrpc': '2.0',
|
||||||
|
\ 'id': 1,
|
||||||
|
\ 'result': v:null,
|
||||||
|
\})
|
||||||
|
|
|
@ -209,7 +209,7 @@ Execute(Other files should be jumped to for LSP definition responses):
|
||||||
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||||
\ ],
|
\ ],
|
||||||
\ g:expr_list
|
\ g:expr_list
|
||||||
AssertEqual [3, 7], getpos('.')[1:2]
|
AssertEqual [3, 8], getpos('.')[1:2]
|
||||||
AssertEqual {}, ale#definition#GetMap()
|
AssertEqual {}, ale#definition#GetMap()
|
||||||
|
|
||||||
Execute(Locations inside the same file should be jumped to without using :edit):
|
Execute(Locations inside the same file should be jumped to without using :edit):
|
||||||
|
@ -231,7 +231,7 @@ Execute(Locations inside the same file should be jumped to without using :edit):
|
||||||
\ [
|
\ [
|
||||||
\ ],
|
\ ],
|
||||||
\ g:expr_list
|
\ g:expr_list
|
||||||
AssertEqual [3, 7], getpos('.')[1:2]
|
AssertEqual [3, 8], getpos('.')[1:2]
|
||||||
AssertEqual {}, ale#definition#GetMap()
|
AssertEqual {}, ale#definition#GetMap()
|
||||||
|
|
||||||
Execute(Other files should be jumped to in tabs for LSP definition responses):
|
Execute(Other files should be jumped to in tabs for LSP definition responses):
|
||||||
|
@ -254,7 +254,7 @@ Execute(Other files should be jumped to in tabs for LSP definition responses):
|
||||||
\ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
\ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||||
\ ],
|
\ ],
|
||||||
\ g:expr_list
|
\ g:expr_list
|
||||||
AssertEqual [3, 7], getpos('.')[1:2]
|
AssertEqual [3, 8], getpos('.')[1:2]
|
||||||
AssertEqual {}, ale#definition#GetMap()
|
AssertEqual {}, ale#definition#GetMap()
|
||||||
|
|
||||||
Execute(Definition responses with lists should be handled):
|
Execute(Definition responses with lists should be handled):
|
||||||
|
@ -285,7 +285,7 @@ Execute(Definition responses with lists should be handled):
|
||||||
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
|
||||||
\ ],
|
\ ],
|
||||||
\ g:expr_list
|
\ g:expr_list
|
||||||
AssertEqual [3, 7], getpos('.')[1:2]
|
AssertEqual [3, 8], getpos('.')[1:2]
|
||||||
AssertEqual {}, ale#definition#GetMap()
|
AssertEqual {}, ale#definition#GetMap()
|
||||||
|
|
||||||
Execute(Definition responses with null response should be handled):
|
Execute(Definition responses with null response should be handled):
|
||||||
|
|
Reference in a new issue