summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-02-06 21:34:19 +0900
committerGitHub <noreply@github.com>2021-02-06 21:34:19 +0900
commitf9f2ad276507ec6fb3d92f3f3525de1cb4d17281 (patch)
tree586defd5924b7ff29c4e38fbf6c0affeb129789d
parentb88d3c4e4bcaedcf42872186a96f7c21975fc68e (diff)
parent26b92f73b5e0f54b0053cf2bd69b79f4f01afe91 (diff)
downloadale-f9f2ad276507ec6fb3d92f3f3525de1cb4d17281.zip
Merge pull request #3571 from rfwatson/gopls-add-init-options
gopls: add go_gopls_init_options
-rw-r--r--ale_linters/go/gopls.vim2
-rw-r--r--doc/ale-go.txt21
-rw-r--r--test/command_callback/test_gopls_command_callback.vader3
3 files changed, 26 insertions, 0 deletions
diff --git a/ale_linters/go/gopls.vim b/ale_linters/go/gopls.vim
index dcff5ec7..f3f1bd6b 100644
--- a/ale_linters/go/gopls.vim
+++ b/ale_linters/go/gopls.vim
@@ -4,6 +4,7 @@
call ale#Set('go_gopls_executable', 'gopls')
call ale#Set('go_gopls_options', '--mode stdio')
+call ale#Set('go_gopls_init_options', {})
function! ale_linters#go#gopls#GetCommand(buffer) abort
return ale#go#EnvString(a:buffer)
@@ -31,4 +32,5 @@ call ale#linter#Define('go', {
\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')},
\ 'command': function('ale_linters#go#gopls#GetCommand'),
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
+\ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')},
\})
diff --git a/doc/ale-go.txt b/doc/ale-go.txt
index 5c0791bc..8364fd5b 100644
--- a/doc/ale-go.txt
+++ b/doc/ale-go.txt
@@ -207,6 +207,27 @@ g:ale_go_gopls_options *g:ale_go_gopls_options*
Type: |String|
Default: `''`
+ Command-line options passed to the gopls executable. See `gopls -h`.
+
+
+g:ale_go_gopls_init_options *g:ale_go_gopls_init_options*
+ *b:ale_go_gopls_init_options*
+ Type: |Dictionary|
+ Default: `{}`
+
+ LSP initialization options passed to gopls. This can be used to configure
+ the behaviour of gopls.
+
+ Example: >
+ let g:ale_go_gopls_init_options = {'ui.diagnostic.analyses': {
+ \ 'composites': v:false,
+ \ 'unusedparams': v:true,
+ \ 'unusedresult': v:true,
+ \ }}
+<
+
+ For a full list of supported analyzers, see:
+ https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md
===============================================================================
govet *ale-go-govet*
diff --git a/test/command_callback/test_gopls_command_callback.vader b/test/command_callback/test_gopls_command_callback.vader
index 73fcbf03..590d8458 100644
--- a/test/command_callback/test_gopls_command_callback.vader
+++ b/test/command_callback/test_gopls_command_callback.vader
@@ -36,6 +36,9 @@ Execute(should set gopls options):
AssertLinter 'gopls',
\ ale#Escape('gopls') . ' --mode stdio --trace'
+ let b:ale_go_gopls_init_options = {'ui.diagnostic.analyses': {'composites': v:false}}
+ AssertLSPOptions {'ui.diagnostic.analyses': {'composites': v:false}}
+
Execute(should support go environment variables):
let b:ale_go_go111module = 'off'