-
-
Notifications
You must be signed in to change notification settings - Fork 954
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
signatureHelp doesn't work for similar parameters #269
Comments
It's just what returns by ccls, should be from cache of ccls.
The autocmd triggered as expected, you can try it with other command, ccls doesn't give correct active param (always 0), but clangd does. |
Ops, ok, sorry, I was betting this was some regex matching issue on parameters without name. cc @MaskRay |
Hi @chemzqm, I just tried clangd (same configuration as the wiki), and it provides the same behavior as in the video for the part of not highlighting current parameter (it does refresh the signature correctly though). |
Just tried with clangd and ccls, they both work as expected for me. |
|
clangdServer seems to be responding correctly: On file open: void foo(int, int) {}
int main() {
} On end of session: void foo(int, int) {}
int main() {
foo(4,
} |
|
It is one of my complaints https://github.com/MaskRay/ccls/wiki/LSP
|
With just the following, it indeed requires some extra logic on client's side:
|
Instead of matching the parameter labels with the content of the signature label, one could simply reconstruct the signature out of the parameter labels. It's easier at least. |
Server could send indexes as label to resolve this problem, it's new signature. |
That's starts being problematic when Unicode is involved. |
It's unicode index, same as character in position. |
Unicode is problematic because in LSP |
Ugh, that's bad. Didn't know that. |
The easiest way to fix this problem is never define function with identical parameters. |
I think it's OK, it's rare case that user use unicode for define functions, and the acuracy is not important here. |
There are entire APIs in this form:
|
A general problem with current solution, even with a correct implementation (getting indexes of the correct submatch), is the assumption that parameter labels will match signature label content. Does LSP provide such guarantees that compliant clients need to conform? In my view signature label could possibly contain terser form for parameters, if there's freedom for that, with parameter labels containing full form of each one. Type signatures can be rather long, so that's one reason to have that, it could even be as neat as |
Thanks, there's some mention of indexes and constrains, but I don't understand why there's two |
Web page bug, there's just one on vscode implementation. Possibly an artifact of version 2.x: https://github.com/Microsoft/language-server-protocol/blob/master/versions/protocol-2-x.md#signature-help-request |
So, according to spec, must be substrings. Sad, I thought current parameter full form expansion was neat idea. Version 2.x didn't have this limitation, so it was better. |
This has been added 3 days back o_O. |
LSP 3.14 allows ParameterInformation.label to be interface ParameterInformation {
/**
* The label of this parameter information.
*
* Either a string or an inclusive start and exclusive end offsets within its containing
* signature label. (see SignatureInformation.label). *Note*: A label of type string must be
* a substring of its containing signature label.
*/
label: string | [number, number];
...
} Pushed a commit to ccls:
|
@MaskRay nice you're using the new |
In fact, this is the correct way to follow the current spec to support string as sub-labels. There's no other correct way. The correct match should be found, otherwise it's the language server to blame.
|
I mean, if you start matching where parameters starts. A signature with return type and the function name itself, coming first, can still confuse that resolve. |
FYI, I had long discussion over this here, IMO they just messed up naming and intention on this part, reason why clients and servers have been struggling here: microsoft/language-server-protocol#640. |
With basic literal textual match, no need for regex, or escaping for regex. At least according to spec. |
Result from CocInfo
Run
:CocInfo
command and paste the content below.Describe the bug
A clear and concise description of what the bug is.
Two issues identified when prototypes have parameters without names:
signatureHelp
gets refreshed thoughautocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
To Reproduce
Steps to reproduce the behavior:
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: