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

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 <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
This commit is contained in:
Rebecca Stambler 2019-03-12 12:53:45 -04:00
parent 7b79afddac
commit e65039ee41

View File

@ -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) {