Compare commits

...

8 Commits

Author SHA1 Message Date
w0rp c76d8aa0b5
Merge pull request #1900 from McSwaggens/master
Fixed NASM linter from outputting junk file
2018-09-10 09:26:35 +01:00
w0rp 9518ea9acc
Fix #1866 - Handle empty output from Perl 2018-09-06 09:23:54 +01:00
w0rp 30d1b37a56
Fix the dart language server command and cover it with tests 2018-09-04 11:16:47 +01:00
w0rp 26ceba0e47
Merge pull request #1861 from dimbleby/goto-definition-column
Fix out-by-one error in column on goto-definition
2018-08-28 10:12:46 +01:00
w0rp 3b7eb6a140
Fix #1844 - Make the kotlin languageserver linter work again 2018-08-24 10:41:44 +01:00
w0rp 3530aa6861
Merge pull request #1841 from dabbeg/fix-importjs-fixer
importjs fixer not reading correct executable variable name
2018-08-24 10:32:28 +01:00
w0rp 3c6af5f68d
Use &l:equalprg so local options do not override global ones 2018-08-17 10:11:10 +01:00
w0rp 277313b58d
Fix #1816 - Fix a type error in the initialize message handler 2018-08-16 14:20:45 +01:00
17 changed files with 56 additions and 21 deletions

View File

@ -15,6 +15,6 @@ call ale#linter#Define('dart', {
\ 'name': 'language_server',
\ 'lsp': 'stdio',
\ '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',
\})

View File

@ -23,7 +23,7 @@ call ale#linter#Define('kotlin', {
\ 'name': 'languageserver',
\ 'lsp': 'stdio',
\ 'executable_callback': ale#VarFunc('kotlin_languageserver_executable'),
\ 'command_callback': '%e',
\ 'command': '%e',
\ 'language': 'kotlin',
\ 'project_root_callback': 'ale_linters#kotlin#languageserver#GetProjectRoot',
\})

View File

@ -8,10 +8,12 @@ function! ale_linters#nasm#nasm#GetCommand(buffer) abort
" Note that NASM requires a trailing slash for the -I option.
let l:separator = has('win32') ? '\' : '/'
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)
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
\ . ' %s'
\ . ' -o ' . l:output_null
endfunction
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort

View File

@ -14,6 +14,10 @@ let s:begin_failed_skip_pattern = '\v' . join([
\], '|')
function! ale_linters#perl#perl#Handle(buffer, lines) abort
if empty(a:lines)
return []
endif
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
let l:output = []
let l:basename = expand('#' . a:buffer . ':t')

View File

@ -49,7 +49,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
for l:item in l:result
let l:filename = ale#path#FromURI(l:item.uri)
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)
break

View File

@ -243,7 +243,7 @@ endfunction
" (name, func, filetypes, desc, aliases)
function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
" This command will throw from the sandbox.
let &equalprg=&equalprg
let &l:equalprg=&l:equalprg
if type(a:name) isnot v:t_string
throw '''name'' must be a String'

View File

@ -1,7 +1,7 @@
" Author: Jeff Willette <jrwillette88@gmail.com>
" 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
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
@ -9,7 +9,7 @@ function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
endfunction
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)
return 0

View File

@ -53,7 +53,7 @@ endfunction
" Do not call this function.
function! ale#linter#GetLintersLoaded() abort
" This command will throw from the sandbox.
let &equalprg=&equalprg
let &l:equalprg=&l:equalprg
return s:linters
endfunction
@ -295,7 +295,7 @@ endfunction
function! ale#linter#Define(filetype, linter) abort
" This command will throw from the sandbox.
let &equalprg=&equalprg
let &l:equalprg=&l:equalprg
if !has_key(s:linters, a:filetype)
let s:linters[a:filetype] = []

View File

@ -256,7 +256,8 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort
endif
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)
for [l:dir, l:project] in l:uninitialized_projects

View File

@ -268,7 +268,7 @@ endfunction
" See :help sandbox
function! ale#util#InSandbox() abort
try
let &equalprg=&equalprg
let &l:equalprg=&l:equalprg
catch /E48/
" E48 is the sandbox error.
return 1

View File

@ -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')

View File

@ -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')

View File

@ -2,9 +2,9 @@ Before:
call ale#assert#SetUpLinterTest('nasm', 'nasm')
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 =
\ ' -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:
unlet! b:command_tail
@ -23,7 +23,7 @@ Execute(The options should be configurable):
let b:ale_nasm_nasm_options = '-w-macro-params'
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):
let b:ale_nasm_nasm_options = '-w+orphan-labels'

View File

@ -1,8 +1,8 @@
Before:
Save g:ale_js_importjs_executable
Save g:ale_javascript_importjs_executable
" 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#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(''))
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
\ {
\ '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(''))

View File

@ -7,6 +7,11 @@ After:
call ale#test#RestoreDirectory()
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):
call ale#test#SetFilename('bar.pl')

View File

@ -181,3 +181,10 @@ Execute(Disabled capabilities should be recognised correctly):
\ },
\ },
\ 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,
\})

View File

@ -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')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
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
AssertEqual [3, 7], getpos('.')[1:2]
AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
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')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
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')),
\ ],
\ g:expr_list
AssertEqual [3, 7], getpos('.')[1:2]
AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
Execute(Definition responses with null response should be handled):