You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In VSCode 1.6 the behavior of activeSignature parameter was changed.
Before 1.6 if you don't assign any value to it, the window with signatures was shown without any glitches.
In 1.7 if you don't assing a value to it, you'll get:
But
In direct implemantation you can't get the current active signature, selected by user. And now (in >=1.6) you need to reassign it to 0 every time the signature provider is triggered, and you just override user active signature every that time.
Please, make activeSignature not mandatory againg in direct implementation, or provide a method, to get user selected signature.
This was a problem in the language server protocol and that this worked was a bug. The SignatureHelp providers must say what the active signature and active parameter is based on the cursor position. That is why the cursor position is part of the request. Only a language service can answer that. Otherwise the editor would need to know what separator character (for example ,) or what overload strategy the language has.
I will change this for the next version of the protocol. I also we add code to default this to zero/zero but this has consequence on the rendering since we will make the active parameter bold.
Dirk Bäumer (@dbaeumer) how you can calculate active signature from cursor position?
I type some method and opening bracket. Cursor is after the bracket and no parameters is even typed. How can i get a change active signature event? Is some event fired on signature change in server model?
function foo(index: number)
function foo(value: string, index: number)
and the user types foo(
then the active signature is either 0 or 1 since you don't have enough information. So we always default to 0. The activeParameter is 0.
if the user types foo("
then you can be smart and say the active signature is 1 since that one takes a string as its first argument.
Interesting: João Moreno (@joaomoreno)Johannes Rieken (@jrieken) could we do something about this. Shouldn't we send the active selected signature on the next request so that a server could respond accordingly.
Activity
dbaeumer commentedon Dec 1, 2016
This was a problem in the language server protocol and that this worked was a bug. The SignatureHelp providers must say what the active signature and active parameter is based on the cursor position. That is why the cursor position is part of the request. Only a language service can answer that. Otherwise the editor would need to know what separator character (for example ,) or what overload strategy the language has.
I will change this for the next version of the protocol. I also we add code to default this to zero/zero but this has consequence on the rendering since we will make the active parameter bold.
nixel2007 commentedon Dec 1, 2016
Dirk Bäumer (@dbaeumer) how you can calculate active signature from cursor position?
I type some method and opening bracket. Cursor is after the bracket and no parameters is even typed. How can i get a change active signature event? Is some event fired on signature change in server model?
dbaeumer commentedon Dec 1, 2016
If the signature if like this
function foo(index: number)
function foo(value: string, index: number)
and the user types foo(
then the active signature is either 0 or 1 since you don't have enough information. So we always default to 0. The activeParameter is 0.
if the user types foo("
then you can be smart and say the active signature is 1 since that one takes a string as its first argument.
nixel2007 commentedon Dec 1, 2016
But this overriding to 0 is annoying, you know. If i change it manualy to ie 2, and then type any key, it resets to default (0).
But i've heard you, there is no way to understand what signature was selected by user know. Sad but true. =(
dbaeumer commentedon Dec 2, 2016
Interesting: João Moreno (@joaomoreno) Johannes Rieken (@jrieken) could we do something about this. Shouldn't we send the active selected signature on the next request so that a server could respond accordingly.
KamasamaK commentedon Aug 28, 2017
Dirk Bäumer (@dbaeumer) That would be great. Is there a separate issue for that?
dbaeumer commentedon Aug 29, 2017
KamasamaK not that I am aware of. Feel free to create one.