-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: cannot send false responses in capabilities #46052
Comments
Thanks for the report.
I'm not sure this is a bug. Per the spec, "A missing property should be interpreted as an absence of the capability.". Is there a case where the client would actually interpret incorrect capabilities as a result of the |
Hi @findleyr Sure a couple of ideas come to mind....
That referred the to the Client Capabilities from the client to the server. I couldn't find the same for the Server Capabilities. On searching through the spec I couldn't see any That said, I can see that what I was actually seeing was the server capabilities for things like https://github.com/golang/tools/blob/master/internal/lsp/protocol/tsprotocol.go#L3603 Unless I'm doing something completely wrong 🤷♂️ |
Yes that part of the spec referenced client capabilities, but absent any commentary on server capabilities (which is directly below), I assume the same applies to server capabilities. The spec tends not to have a lot of details, unfortunately.
I don't think there can be any basic capabilities that can default to true, as per the wording missing configuration=>no capability. I agree that it would be cleaner if these were all pointers, but I don't think it's a bug per-se. I think the zero-value configuration has the correct semantics when marshaled to JSON. CC @pjweinb who knows more of the history here, and might have a different opinion. |
i think @findelyr is right. The definition in the typescript code says that
resolveProvider is optional. In typescript a logical test of an undefined
value is treated as false.
IsRetrigger (in SignatureHelpContext) is an example of a bool that is not
optional.
…On Wed, May 12, 2021 at 9:29 AM findleyr ***@***.***> wrote:
That referred the to the Client Capabilities from the client to the server
Yes that part of the spec referenced client capabilities, but absent any
commentary on server capabilities (which is directly below), I assume the
same applies to server capabilities. The spec tends not to have a lot of
details, unfortunately.
On searching through the spec I couldn't see any booleans that defaulted
to true if omitted. But I could've missed one...
I don't think there can be any basic capabilities that can default to
true, as per the wording missing configuration=>no capability.
I agree that it would be *cleaner* if these were all pointers, but I
don't think it's a bug per-se. I think the zero-value configuration has the
correct semantics when marshaled to JSON.
CC @pjweinb <https://github.com/pjweinb> who knows more of the history
here, and might have a different opinion.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#46052 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJIAI5PNFH2QPMASFHRFA3TNJ7CPANCNFSM44M53ZOQ>
.
|
Thanks both of you! I'm happy to close this issue and raise one about the non-nil-able resolvers (like |
Sure sounds good--please raise a new issue if needed. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Probably
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm working on implementing a Language Server in Go (but not for golang itself). I was trying send a response from Lang. Server to the Language client to indicate I did not support many of the providers, e.g. CodeLens however the JSON response was not showing the
false
entries. e.g.When I use the following response in Go.
When it is converted to JSON, the output just ignores it
Note the
documentLinkProvider":{}
. It should have{ resolveProvider: false}
What did you expect to see?
It should out the response fully in JSON
What did you see instead?
It ignores bools with
false
This is probably due to:
https://github.com/golang/tools/blob/master/internal/lsp/protocol/tsprotocol.go#L1739
This could (probably) be solved using
*bool
but as this file is automatically generated, this seems like a fix that needs to be made in the tools.Now, while this code is internal and my usecase is not normal, I did notice that gopls will set a false value and this will not be sent to the Language client. And would be considered a bug.
https://github.com/golang/tools/blob/3e17c62e37b686d70c24a370a51cd33f8aa52df2/internal/lsp/general.go#L150
The text was updated successfully, but these errors were encountered: