summaryrefslogtreecommitdiff
path: root/test/lsp/test_lsp_command_formatting.vader
blob: 9d2c84ee0ad65b44130423088a4ceee0c9f6a15b (plain)
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
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',
  \ },
  \)

  if has('win32')
    AssertEqual
    \ ['cmd', 'cmd /s/c "cmd --foo"', {}],
    \ g:args
  else
    AssertEqual
    \ ['true', [&shell, '-c', '''true'' --foo'], {}],
    \ g:args
  endif