-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Apologies if this is not the right place to file this.
The analysis server will generate SignatureHelp objects which violate the LSP by including a -1 for activeParameter -- this value is supposed to be an unsigned integer and you are returning -1. spec link.
sdk/pkg/analysis_server/lib/src/lsp/mapping.dart
Lines 1591 to 1599 in d38e0ff
| // TODO(dantup): The LSP spec says this value will default to 0 if it's | |
| // not supplied or outside of the value range. However, setting -1 results | |
| // in no parameters being selected in VS Code, whereas null/0 will select the first. | |
| // We'd like for none to be selected (since we don't support this yet) so | |
| // we send -1. I've made a request for LSP to support not selecting a parameter | |
| // (because you could also be on param 5 of an invalid call to a function | |
| // taking only 3 arguments) here: | |
| // https://github.com/Microsoft/language-server-protocol/issues/456#issuecomment-452318297 | |
| activeParameter: -1, // activeParameter |
sdk/pkg/analysis_server/lib/src/computer/computer_type_arguments_signature.dart
Lines 111 to 118 in d38e0ff
| return lsp.SignatureHelp( | |
| signatures: signatures, | |
| activeSignature: 0, | |
| // As with [toSignatureHelp], we don't currently use this, but need to set | |
| // it to something that doesn't match a parameter to avoid one being | |
| // selected. | |
| activeParameter: -1, | |
| ); |
There is a link in the code to a discussion by @DanTup from 5 years ago:
Which was resolved 9 months later, but the code link with explanation has since gone stale and the code remains.
I am not a dart developer and did not personally experience this, but a discovered a user was having a bad time in Zed because that field is supposed to be an unsigned integer:
The user encountered this on NixOS on aarch64. I'm not sure the version they were running, but looking at the git blame in main it appears this has been the behavior for the last five years. The log in that issue includes the complete response where the user encountered this value of -1.
We can probably fix this on our end in Zed, but I wanted to mention the issue since I saw it in the wild. I haven't dug into how this behaves on neovim, helix or other LSP consumers but out of the box it's broken for Zed.
Thanks!
