From e65039ee4138194d75ebaa2da35887260d5e15b2 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Tue, 12 Mar 2019 12:53:45 -0400 Subject: [PATCH] internal/lsp: make sure completion items are never null Change-Id: Ic6e0988319f8fb2c91b473ac2fa5480dc25dc0b7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/167158 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Peter Weinberger --- internal/lsp/completion.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lsp/completion.go b/internal/lsp/completion.go index 52a8c76d..b9f4e209 100644 --- a/internal/lsp/completion.go +++ b/internal/lsp/completion.go @@ -22,7 +22,7 @@ func toProtocolCompletionItems(candidates []source.CompletionItem, prefix string sort.SliceStable(candidates, func(i, j int) bool { return candidates[i].Score > candidates[j].Score }) - var items []protocol.CompletionItem + items := []protocol.CompletionItem{} for i, candidate := range candidates { // Matching against the label. if !strings.HasPrefix(candidate.Label, prefix) {