-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Getting "failed get highlight parameter 0 0" #51
Comments
I have the same issue. |
What LSP you are using? |
In my case pyright with built in neovim LSP. |
Same here, using pyright. |
I think this issue is caused by pyright. The log you posted: {
activeParameter = 4,
activeSignature = 0,
signatures = { {
activeParameter = 0,
label = "(a: int, b: int, c: int, d: int) -> None",
parameters = { {
label = { 1, 7 }
}, {
label = { 9, 15 }
}, {
label = { 17, 23 }
}, {
label = { 25, 31 }
} }
} }
} Check this:
|
Isn't the |
I am thinking that perhaps this here needs to be changed: lsp_signature.nvim/lua/lsp_signature_helper.lua Lines 95 to 96 in 78af139
The code there perhaps should read: local activeParameter = signature.activeParameter + 1 |
Different LSP sending activeParameter back in slight different way and that is why local activeParameter = result.activeParameter or signature.active_parameter
or signature.activeParameter But activeParameter=4 is incorrect. All LSP activeParameter is 0 based. |
I had success replacing that line with: local activeParameter = signature.activeParameter or signature.active_parameter or result.activeParameter It works now with pyright. With |
I just checked the spec for
So the code should really read the way I pasted in my previous reply: local activeParameter = signature.activeParameter or signature.active_parameter or result.activeParameter The Here is the link to the documentation: https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#signatureHelp |
I do not know why the designer decided to send an out of range index to indicate it to be 0 in 3.17 . What a nice pitfall! I pushed my changes. |
I checked the changes there, and I think you should still change the order for setting the |
@henrique-ezcater activeParameter: And I also override activeParameter with signature.activeParameter if it present: if result.activeParameter ~= nil and result.activeParameter < #signature.parameters then
activeParameter = result.activeParameter
else
activeParameter = 0
end
if signature.activeParameter ~= nil then
activeParameter = signature.activeParameter
end
I am avoiding doing hacky things for a specific LSP. I can do a special fix for pyright when I know the exact behaviour so I can know the fix will not break other LSP. |
Yeah, I've checked the code again and I noticed I had missed part of the logic. Seems like this is in accordance to the spec. |
Hello!
I am trying get highlight of the parameters in the pop-up, but as soon as I type
(
to provide the parameters I get the errorfailed get highlight parameter 0 0
.This is using
pyright
and the following python code can be used to reproduce it:Here is a screenshot:
Here is the debug output:
From a quick glance at the code, I couldn't figure out the issue. I got here:
lsp_signature.nvim/lua/lsp_signature_helper.lua
Line 114 in 78af139
Can't really tell why that is returning nil? Or perhaps I am following the code incorrectly. My lua skillz aren't that great.
Any ideas?
Thanks!
The text was updated successfully, but these errors were encountered: