This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/command_callback/test_golangserver_command_callback.vader
Jon Parise b5a7593577 Add a lsp_config_callback linter option
This is the callback-based variant of the existing `lsp_config` linter
option. It serves the same purpose but can be used when more complicated
processing is needed.

`lsp_config` and `lsp_config_callback` are mutually exclusive options;
if both an given, a linter preprocessing error will be raised.

The runtime logic has been wrapped in `ale#lsp_linter#GetConfig` for
convenience, similar to `ale#lsp_linter#GetOptions`.

This also adds documentation and an `AssertLSPConfig` test function for
completeness.
2018-10-31 08:42:42 -07:00

68 lines
1.9 KiB
Text

Before:
Save $GOPATH
Save g:ale_completion_enabled
let g:ale_completion_enabled = 0
let g:sep = has('win32') ? ';' : ':'
call ale#assert#SetUpLinterTest('go', 'langserver')
let $GOPATH = ale#path#Simplify(g:dir . '/go_paths/go1')
\ . g:sep
\ . ale#path#Simplify(g:dir . '/go_paths/go2')
After:
Restore
unlet! b:ale_completion_enabled
unlet! g:sep
call ale#assert#TearDownLinterTest()
Execute(should set correct defaults):
AssertLinter 'go-langserver', ale#Escape('go-langserver')
Execute(should configure go-langserver callback executable):
let b:ale_go_langserver_executable = 'boo'
AssertLinter 'boo', ale#Escape('boo')
Execute(should set go-langserver options):
call ale#test#SetFilename('go_paths/go1/prj1/file.go')
let b:ale_completion_enabled = 1
let b:ale_go_langserver_options = ''
AssertLinter 'go-langserver',
\ ale#Escape('go-langserver') . ' -gocodecompletion'
let b:ale_go_langserver_options = '-trace'
AssertLinter 'go-langserver',
\ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
Execute(should ignore go-langserver -gocodecompletion option):
call ale#test#SetFilename('go_paths/go1/prj1/file.go')
let b:ale_go_langserver_options = '-trace -gocodecompletion'
let b:ale_completion_enabled = 1
AssertLinter 'go-langserver',
\ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
let b:ale_completion_enabled = 0
AssertLinter 'go-langserver', ale#Escape('go-langserver') . ' -trace'
Execute(should set go-langserver for go app1):
call ale#test#SetFilename('go_paths/go1/prj1/file.go')
AssertLSPLanguage 'go'
AssertLSPConfig {}
AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go1')
Execute(should set go-langserver for go app2):
call ale#test#SetFilename('go_paths/go2/prj1/file.go')
AssertLSPLanguage 'go'
AssertLSPOptions {}
AssertLSPConfig {}
AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go2')