this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lsp/cache: completions must not return null items list

The spec for completions does not permit JSON `null` for
`CompletionList.items`. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionList

However, in the case that we have no completions to offer, we were
sending a `null` value, which was causing issues with some editors,
such as intellij.

I've checked the other LSP features we support and I don't believe we
suffer from this elsewhere.

Change-Id: I69044a20d8d79f56a795681c588a976b6401dc28
Signed-off-by: Matthew Sackman <matthew@cue.works>
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1231226
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+2 -1
+2 -1
internal/lsp/cache/eval.go
··· 217 217 isJsonSrc := file.buildFile != nil && file.buildFile.Encoding == build.JSON 218 218 isYamlSrc := file.buildFile != nil && file.buildFile.Encoding == build.YAML 219 219 220 - var completionItems []protocol.CompletionItem 220 + // We must not return a nil list of completions 221 + completionItems := []protocol.CompletionItem{} 221 222 222 223 for completion, names := range completions { 223 224 if len(names) == 0 {