Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add options to configure gopls #2567

Merged
merged 1 commit into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions autoload/go/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,22 @@ function! go#config#ReferrersMode() abort
return get(g:, 'go_referrers_mode', 'gopls')
endfunction

function! go#config#GoplsCompleteUnimported() abort
return get(g:, 'go_gopls_complete_unimported', 0)
endfunction

function! go#config#GoplsDeepCompletion() abort
return get(g:, 'go_gopls_deep_completion', 1)
endfunction

function! go#config#GoplsFuzzyMatching() abort
return get(g:, 'go_gopls_fuzzy_matching', 1)
endfunction

function! go#config#GoplsUsePlaceholders() abort
return get(g:, 'go_gopls_use_placeholders', 0)
endfunction

" Set the default value. A value of "1" is a shortcut for this, for
" compatibility reasons.
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
Expand Down
4 changes: 4 additions & 0 deletions autoload/go/lsp/message.vim
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ function! go#lsp#message#ConfigurationResult(items) abort
let l:config = {
\ 'buildFlags': [],
\ 'hoverKind': 'NoDocumentation',
\ 'deepCompletion': go#config#GoplsDeepCompletion(),
\ 'fuzzyMatching': go#config#GoplsFuzzyMatching(),
\ 'completeUnimported': go#config#GoplsCompleteUnimported(),
\ 'usePlaceholders': go#config#GoplsUsePlaceholders(),
\ }
let l:buildtags = go#config#BuildTags()
if buildtags isnot ''
Expand Down
33 changes: 33 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,39 @@ Specifies whether `gocode` should use a different socket type. By default
>
let g:go_gocode_socket_type = 'unix'
<

*'g:go_gopls_complete_unimported'*

Specifies whether `gopls` should include suggestions from unimported packages.
By default it is disabled.
>
let g:go_gopls_complete_unimported = 0
<

*'g:go_gopls_deep_completion'*

Specifies whether `gopls` should use deep completion. By default it is
enabled.
>
let g:go_gopls_deep_completion = 1
<

*'g:go_gopls_fuzzy_matching'*

Specifies whether `gopls` should use fuzzy matching for completions.
By default it is enabled.
>
let g:go_gopls_fuzzy_matching = 1
<

*'g:go_gopls_use_placeholders'*

Specifies whether `gopls` can provide placeholders for function parameters and
struct fields. By default it is disabled.
>
let g:go_gopls_use_placeholders = 0
<

*'g:go_template_autocreate'*

When a new Go file is created, vim-go automatically fills the buffer content
Expand Down