mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-31 07:05:31 +08:00
Fix command formatting for LSP linters
This commit is contained in:
37
test/lsp/test_lsp_command_formatting.vader
Normal file
37
test/lsp/test_lsp_command_formatting.vader
Normal file
@@ -0,0 +1,37 @@
|
||||
Before:
|
||||
runtime autoload/ale/lsp.vim
|
||||
|
||||
let g:args = []
|
||||
|
||||
" Mock the StartProgram function so we can just capture the arguments.
|
||||
function! ale#lsp#StartProgram(...) abort
|
||||
let g:args = a:000
|
||||
endfunction
|
||||
|
||||
After:
|
||||
unlet! g:args
|
||||
|
||||
runtime autoload/ale/lsp.vim
|
||||
|
||||
Execute(Command formatting should be applied correctly for LSP linters):
|
||||
call ale#lsp_linter#StartLSP(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ 'language_callback': {-> 'x'},
|
||||
\ 'project_root_callback': {-> '/foo/bar'},
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': has('win32') ? 'cmd': 'true',
|
||||
\ 'command': '%e --foo',
|
||||
\ },
|
||||
\ {->0}
|
||||
\)
|
||||
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ ['true', 'cmd /s/c cmd --foo', '/foo/bar'],
|
||||
\ g:args[:2]
|
||||
else
|
||||
AssertEqual
|
||||
\ ['true', ['/bin/bash', '-c', '''true'' --foo'], '/foo/bar'],
|
||||
\ g:args[:2]
|
||||
endif
|
||||
Reference in New Issue
Block a user