summaryrefslogtreecommitdiff
path: root/test/lsp/test_lsp_command_formatting.vader
blob: ec3b4120c538f630d2107fdf59b42d67fe5867de (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
37
38
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[1:]
  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(''),
  \ {
  \   '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