1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:44:46 -07:00

internal/lsp: configure completion to preselect the first item

The language client must support the preselect feature, so as of right
now, I don't think that this change has any effect. However, ultimately,
we should preselect the first completion item we suggest, as we rank
items.

Change-Id: I977cce26157504595a0193ab551685e21a3df155
Reviewed-on: https://go-review.googlesource.com/c/tools/+/167466
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Rebecca Stambler 2019-03-13 21:41:54 -04:00
parent 8781451fe3
commit 8b67d361bb

View File

@ -51,6 +51,7 @@ func toProtocolCompletionItems(candidates []source.CompletionItem, prefix string
// https://github.com/Microsoft/language-server-protocol/issues/348. // https://github.com/Microsoft/language-server-protocol/issues/348.
SortText: fmt.Sprintf("%05d", i), SortText: fmt.Sprintf("%05d", i),
FilterText: insertText, FilterText: insertText,
Preselect: i == 0,
} }
// If we are completing a function, we should trigger signature help if possible. // If we are completing a function, we should trigger signature help if possible.
if triggerSignatureHelp && signatureHelpEnabled { if triggerSignatureHelp && signatureHelpEnabled {