-
Notifications
You must be signed in to change notification settings - Fork 30
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
[LSP Spec]: In response of signatureHelp, activeParameter
starts from 1
#972
Comments
I tested it further and found that the signaturehelp of This behavior is strange |
is could you please provide steps on how to reproduce this? something like:
|
yeah i don't really understand what signatureHelp is and the language server documentation doesn't have any screenshots so i will need some more information. preferably a screenshot of what exactly is incorrect with |
I will try to check the logs later |
when you say that it "starts from 1", what exactly do you mean? how do you know that it is starting from 1? where you can see this information? |
Please ignore my initial report As a test, I directly printed the response information of signaturehelp (which has been automatically converted to Lua's table by neovim's lsp function) I noticed that Here is a link to the canonical documentation for the response: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#signatureHelp for {
activeParameter = 3,
signatures = { {
documentation = {
kind = "markdown",
value =
"Sort the list in ascending order and return None.\n\nThe sort is in-place (i.e. the list itself is modified) and stable (i.e. the\norder of two equal elements is maintained).\n\nIf a key function is given, apply it once to each list item and sort them,\nascending or descending, according to their function values.\n\nThe reverse flag can be set to sort in descending order."
},
label = "(*, key: None = None, reverse: bool = False) -> None",
parameters = { {
documentation = {
kind = "markdown",
value = ""
},
label = { 1, 2 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 4, 20 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 22, 43 }
} }
}, {
documentation = {
kind = "markdown",
value =
"Sort the list in ascending order and return None.\n\nThe sort is in-place (i.e. the list itself is modified) and stable (i.e. the\norder of two equal elements is maintained).\n\nIf a key function is given, apply it once to each list item and sort them,\nascending or descending, according to their function values.\n\nThe reverse flag can be set to sort in descending order."
},
label = "(*, key: (int) -> SupportsRichComparison, reverse: bool = False) -> None",
parameters = { {
documentation = {
kind = "markdown",
value = ""
},
label = { 1, 2 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 4, 40 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 42, 63 }
} }
} }
} for {
activeParameter = 5,
activeSignature = 0,
signatures = { {
activeParameter = 0,
documentation = {
kind = "markdown",
value =
"Prints the values to a stream, or to sys.stdout by default.\n\nsep \n string inserted between values, default a space. \nend \n string appended after the last value, default a newline. \nfile \n a file-like object (stream); defaults to the current sys.stdout. \nflush \n whether to forcibly flush the stream."
},
label =
'(*values: object, sep: str | None = " ", end: str | None = "\\n", file: SupportsWrite[str] | None = None, flush: Literal[False] = False) -> None',
parameters = { {
documentation = {
kind = "markdown",
value = ""
},
label = { 1, 16 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 18, 39 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 41, 63 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 65, 103 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 105, 134 }
} }
}, {
activeParameter = 0,
documentation = {
kind = "markdown",
value =
"Prints the values to a stream, or to sys.stdout by default.\n\nsep \n string inserted between values, default a space. \nend \n string appended after the last value, default a newline. \nfile \n a file-like object (stream); defaults to the current sys.stdout. \nflush \n whether to forcibly flush the stream."
},
label =
'(*values: object, sep: str | None = " ", end: str | None = "\\n", file: _SupportsWriteAndFlush[str] | None = None, flush: bool) -> None',
parameters = { {
documentation = {
kind = "markdown",
value = ""
},
label = { 1, 16 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 18, 39 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 41, 63 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 65, 112 }
}, {
documentation = {
kind = "markdown",
value = ""
},
label = { 114, 125 }
} }
} }
} |
activeSignature
starts from 1activeParameter
starts from 1
I just requested the server to respond to the two functions signaturehelp of |
At present, this seems to be just a problem of non-standard implementation, not a bug. |
thanks for the additional information
when you say that it starts from did your code sample look like: [].sort(1, 2, 3)
i can't see that referenced anywhere in the docs that you linked, i can see this though:
although i am very sure that this value is zero-based, so i would assume it starts from 0 could you please elaborate what you mean by "it should start from as far as i can tell, given: def f(a, b, c): ...
f(a, b<caret>, c) then additionally, the correct parameter is selected in various editors that we have tested this on maybe if you provided an expected and actual result, so that we can better comprehend the situation. and include the source code that you are using when triggering this. screenshots would also help if possible |
how are you getting |
Yes, this is exactly what I am confused about. I don't understand why this response is returned to me. |
Maybe I need to double check the request information I sent |
so the issue is not that it is starting from |
No, no, you can find that paramters in the response content is an array with only three elements, so the maximum |
Just after you reminded me, I found that the activeParamter value returned is 3, which is not correct. I only noticed the problem that it is greater than 2. |
Maybe basedpyright should be asked to print the complete log |
So it can be said that the current problem is why the outer |
hmm, it would seem that i just noticed in the data you provided that there is no |
activeSignature is optional, defaults to 0 if not |
i don't understand this "defaults to 0", if it's optional, then wouldn't it be |
so is the issue that there's two separate if this is the case i'm curious as to why there are two different keys for the same thing in the first place. one of them should be deleted or at least deprecated. the current docs for this are extremely confusing. |
Yes, this technically shouldn't be an issue, but I thought it was worth reporting. I also think the current documentation is confusing and it's not stated clearly enough Or it would be better to mark the issue as QA |
i've opened microsoft/language-server-protocol#2080 to try and get some clarification, then i'll decide what to do about it on my end. will leave this issue open in the mean time |
I recently discovered a problem when using basedpyright on neovim
But this problem should not require code to reproduce. You only need to find a python method with parameters to verify it.
main
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#signatureHelp
According to doc,
activeParameter
should start from 0, but now it is start from 1I'm not sure if this is really a problem, so I'll ask and if there is no problem please close the issue.
The text was updated successfully, but these errors were encountered: