1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
Before:
Save g:ale_command_wrapper
runtime autoload/ale/lsp.vim
let g:ale_command_wrapper = ''
let g:args = []
" Mock the StartProgram function so we can just capture the arguments.
function! ale#lsp#StartProgram(...) abort
let g:args = a:000[1:]
endfunction
After:
Restore
unlet! g:args
runtime autoload/ale/lsp.vim
Execute(Command formatting should be applied correctly for LSP linters):
call ale#lsp_linter#StartLSP(
\ bufnr(''),
\ {
\ 'name': 'linter',
\ 'language_callback': {-> 'x'},
\ 'project_root_callback': {-> '/foo/bar'},
\ 'lsp': 'stdio',
\ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': '%e --foo',
\ },
\ {-> 0}
\)
if has('win32')
AssertEqual
\ ['cmd', 'cmd /s/c "cmd --foo"'],
\ g:args
else
AssertEqual
\ ['true', [&shell, '-c', '''true'' --foo']],
\ g:args
endif
|