Skip to content

Commit

Permalink
Merge pull request #2994 from bhcleek/lsp/gofumpt
Browse files Browse the repository at this point in the history
lsp: support gofumpt and unknown gopls settings
  • Loading branch information
bhcleek committed Sep 6, 2020
2 parents bbd544f + c1d68cb commit 948a1e1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/go/config.vim
Expand Up @@ -550,6 +550,14 @@ function! go#config#GoplsLocal() abort
return get(g:, 'go_gopls_local', v:null)
endfunction

function! go#config#GoplsGofumpt() abort
return get(g:, 'go_gopls_gofumpt', v:null)
endfunction

function! go#config#GoplsSettings() abort
return get(g:, 'go_gopls_settings', v:null)
endfunction

function! go#config#GoplsEnabled() abort
return get(g:, 'go_gopls_enabled', 1)
endfunction
Expand Down
10 changes: 10 additions & 0 deletions autoload/go/lsp/message.vim
Expand Up @@ -269,6 +269,8 @@ function! go#lsp#message#ConfigurationResult(items) abort
let l:tempModfile = go#config#GoplsTempModfile()
let l:analyses = go#config#GoplsAnalyses()
let l:local = go#config#GoplsLocal()
let l:gofumpt = go#config#GoplsGofumpt()
let l:settings = go#config#GoplsSettings()

if l:deepCompletion isnot v:null
if l:deepCompletion
Expand Down Expand Up @@ -322,6 +324,14 @@ function! go#lsp#message#ConfigurationResult(items) abort
let l:config.local = l:local
endif

if l:gofumpt isnot v:null
let l:config.gofumpt = l:local
endif

if l:settings isnot v:null
let l:config = extend(l:config, l:settings, 'keep')
endif

let l:result = add(l:result, l:config)
endfor

Expand Down
18 changes: 18 additions & 0 deletions doc/vim-go.txt
Expand Up @@ -1874,6 +1874,24 @@ is `v:null`.
let g:go_gopls_local = v:null
<

*'g:go_gopls_gofumpt'*

Specifies whether `gopls` should use `gofumpt` for formatting. When it is
`v:null`, `gopls`' default will be used. By default it is `v:null`.
>
let g:go_gopls_gofumpt = v:null
<

*'g:go_gopls_settings'*

Specifies `gopls` workspace settings for `gopls` that are not yet officially
supported by vim-go. Any value in the dictionary will be overridden by values
provided in the specific options supported by vim-go (e.g.
g:go_gopls_staticcheck) or settings statically configured by vim-go to ensure
expected behavior. By default it is `v:null`.
>
let g:go_gopls_settings = v:null
<
*'g:go_diagnostics_enabled'*

Specifies whether `gopls` diagnostics are enabled. Only the diagnostics for
Expand Down

0 comments on commit 948a1e1

Please sign in to comment.