-
Notifications
You must be signed in to change notification settings - Fork 930
Description
Current the spec specifies that the active signature index defaults to 0 if it is omitted. In a sense the implementation must provide this value or it will simply use 0. The problem lies that the language server doesn't know which item was user selected, as this information lies with the editor and isn't forwarded to the server.
/**
* The active signature. If omitted or the value lies outside the
* range of `signatures` the value defaults to zero or is ignored if
* `signatures.length === 0`. Whenever possible implementors should
* make an active decision about the active signature and shouldn't
* rely on a default value.
* In future version of the protocol this property might become
* mandatory to better express this.
*/
activeSignature?: numberThis means that even if a user explicitly selects an option, and the signature matches for the first set of arguments. Then the server has to choose between two equally acceptable signatures and has no information that the user has explicitly selected one of the two signatures.
Forwarding which signature was previously selected would help keep the user's selection intact in the case that a better match isn't available.
void foo(int one, int two, double three);
void foo(int another, int somethingElse, int again);
void main()
{
foo(0, // cursor here
}As an example, even if the next parameter is given, both signatures are suitable for what has currently been written. But the server still has to make a selection, or the active signature will default to 0. The desired behavior is to keep the user's current selection in this case.