x/tools/gopls: semanticTokens/range returns a generic error if compilation fails #46176
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
Sent a
textDocument/semanticTokens/range
request with the following source file open:What did you expect to see?
Something where the client is able to distinguish "an empty result set" from "failed to deliver a result set".
What did you see instead?
An error (with error code 0 and message containing the compilation error).
From how I understand the LSP specification, the error in a
ResponseMessage
should include an error code that indicate error type. When I look at the list of codes it looks like most of them is for errors defined by JSON RPC or LSP (such as ContentModified / RequestCancelled). I can't find that using code 0 would be allowed in the specification.What I cannot do is to let that the client programatically tell the user if an error is (for example) a communication error, bug in the client or "just" the compilation error. Peter had an idea to respond with null (and no error) if gopls couldn't provide a result. That would work for my particular use case, question is how other LSP clients would handle it.
/cc @pjweinb
The text was updated successfully, but these errors were encountered: