From 8b67d361bba210f5fbb3c1a0fc121e0847b10b57 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Wed, 13 Mar 2019 21:41:54 -0400 Subject: [PATCH] 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 Run-TryBot: Rebecca Stambler --- internal/lsp/completion.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/lsp/completion.go b/internal/lsp/completion.go index 4785ffa8..f0d8bcb6 100644 --- a/internal/lsp/completion.go +++ b/internal/lsp/completion.go @@ -51,6 +51,7 @@ func toProtocolCompletionItems(candidates []source.CompletionItem, prefix string // https://github.com/Microsoft/language-server-protocol/issues/348. SortText: fmt.Sprintf("%05d", i), FilterText: insertText, + Preselect: i == 0, } // If we are completing a function, we should trigger signature help if possible. if triggerSignatureHelp && signatureHelpEnabled {