diff options
-rw-r--r-- | ale_linters/go/govet.vim | 4 | ||||
-rw-r--r-- | autoload/ale/fix/registry.vim | 2 | ||||
-rw-r--r-- | autoload/ale/linter.vim | 4 | ||||
-rw-r--r-- | autoload/ale/lsp.vim | 3 | ||||
-rw-r--r-- | autoload/ale/util.vim | 2 | ||||
-rw-r--r-- | doc/ale-go.txt | 11 | ||||
-rw-r--r-- | doc/ale.txt | 1 | ||||
-rw-r--r-- | test/command_callback/test_govet_command_callback.vader | 4 | ||||
-rw-r--r-- | test/lsp/test_other_initialize_message_handling.vader | 7 |
9 files changed, 33 insertions, 5 deletions
diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim index e94e6ecd..59fea499 100644 --- a/ale_linters/go/govet.vim +++ b/ale_linters/go/govet.vim @@ -4,8 +4,12 @@ " Author: John Eikenberry <jae@zhar.net> " Description: updated to work with go1.10 +call ale#Set('go_govet_options', '') + function! ale_linters#go#govet#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'go_govet_options') return ale#path#BufferCdString(a:buffer) . ' go vet .' + \ . (!empty(l:options) ? ' ' . l:options : '') endfunction call ale#linter#Define('go', { diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index e60d67b6..ef287358 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -243,7 +243,7 @@ endfunction " (name, func, filetypes, desc, aliases) function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort " This command will throw from the sandbox. - let &equalprg=&equalprg + let &l:equalprg=&l:equalprg if type(a:name) isnot v:t_string throw '''name'' must be a String' diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index ab86d77e..aad386aa 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -53,7 +53,7 @@ endfunction " Do not call this function. function! ale#linter#GetLintersLoaded() abort " This command will throw from the sandbox. - let &equalprg=&equalprg + let &l:equalprg=&l:equalprg return s:linters endfunction @@ -295,7 +295,7 @@ endfunction function! ale#linter#Define(filetype, linter) abort " This command will throw from the sandbox. - let &equalprg=&equalprg + let &l:equalprg=&l:equalprg if !has_key(s:linters, a:filetype) let s:linters[a:filetype] = [] diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim index cfc89199..98160995 100644 --- a/autoload/ale/lsp.vim +++ b/autoload/ale/lsp.vim @@ -256,7 +256,8 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort endif if get(a:response, 'method', '') is# '' - if has_key(get(a:response, 'result', {}), 'capabilities') + if type(get(a:response, 'result')) is v:t_dict + \&& has_key(a:response.result, 'capabilities') call s:UpdateCapabilities(a:conn, a:response.result.capabilities) for [l:dir, l:project] in l:uninitialized_projects diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim index e9b5688d..8c69c54f 100644 --- a/autoload/ale/util.vim +++ b/autoload/ale/util.vim @@ -268,7 +268,7 @@ endfunction " See :help sandbox function! ale#util#InSandbox() abort try - let &equalprg=&equalprg + let &l:equalprg=&l:equalprg catch /E48/ " E48 is the sandbox error. return 1 diff --git a/doc/ale-go.txt b/doc/ale-go.txt index 60d6cb84..baf403b7 100644 --- a/doc/ale-go.txt +++ b/doc/ale-go.txt @@ -45,6 +45,17 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options* =============================================================================== +govet *ale-go-govet* + +g:ale_go_govet_options *g:ale_go_govet_options* + *b:ale_go_govet_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the go vet linter. + + +=============================================================================== gometalinter *ale-go-gometalinter* `gometalinter` is a `lint_file` linter, which only lints files that are diff --git a/doc/ale.txt b/doc/ale.txt index 8af4c435..13184e84 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -90,6 +90,7 @@ CONTENTS *ale-contents* go....................................|ale-go-options| gobuild.............................|ale-go-gobuild| gofmt...............................|ale-go-gofmt| + govet...............................|ale-go-govet| gometalinter........................|ale-go-gometalinter| staticcheck.........................|ale-go-staticcheck| graphql...............................|ale-graphql-options| diff --git a/test/command_callback/test_govet_command_callback.vader b/test/command_callback/test_govet_command_callback.vader index a73118ae..3718e0a7 100644 --- a/test/command_callback/test_govet_command_callback.vader +++ b/test/command_callback/test_govet_command_callback.vader @@ -6,3 +6,7 @@ After: Execute(The default command should be correct): AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .' + +Execute(Extra options should be supported): + let g:ale_go_govet_options = '--foo-bar' + AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet . --foo-bar' diff --git a/test/lsp/test_other_initialize_message_handling.vader b/test/lsp/test_other_initialize_message_handling.vader index 45457979..f5e0f1da 100644 --- a/test/lsp/test_other_initialize_message_handling.vader +++ b/test/lsp/test_other_initialize_message_handling.vader @@ -181,3 +181,10 @@ Execute(Disabled capabilities should be recognised correctly): \ }, \ }, \ b:conn + +Execute(Results that are not dictionaries should be handled correctly): + call ale#lsp#HandleOtherInitializeResponses(b:conn, { + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'result': v:null, + \}) |