From 13a899a8ec7d1bf10a1f89d6e72ab4d8025e6714 Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Tue, 31 Dec 2019 09:51:41 -0800 Subject: [PATCH] config: add a test for go_gopls_enabled=0 --- autoload/go/config_test.vim | 20 ++++++++++++++++++++ autoload/go/lsp.vim | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/autoload/go/config_test.vim b/autoload/go/config_test.vim index 1d85e3fcec..f259f64be2 100644 --- a/autoload/go/config_test.vim +++ b/autoload/go/config_test.vim @@ -79,6 +79,26 @@ func! Test_SetBuildTags() abort endtry endfunc +func! Test_GoplsEnabled_Clear() abort + if !go#util#has_job() + return + endif + + try + let g:go_gopls_enabled = 0 + + let l:tmp = gotest#write_file('gopls_disabled.go', [ + \ 'package example', + \ '', + \ 'func Example() {', + \ "\tprintln(" . '"hello, world!")', + \ '}', + \ ] ) + + finally + unlet g:go_gopls_enabled + endtry +endfunc " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save diff --git a/autoload/go/lsp.vim b/autoload/go/lsp.vim index 04c68e70e8..c668b86fd2 100644 --- a/autoload/go/lsp.vim +++ b/autoload/go/lsp.vim @@ -24,7 +24,8 @@ function! s:newlsp() abort let l:lsp = { \ 'sendMessage': funcref('s:noop'), \ 'notificationQueue': {}, - \ 'fileVersions': {} + \ 'fileVersions': {}, + \ 'workspaceDirectories': [], \ } if !go#config#GoplsEnabled()