Skip to content

signatureHelp.activeSignature #16256

Closed
Closed

Description

  • VSCode Version: 1.7.2
  • OS Version: Win10 Enterprise x64

Hello.

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:
image

Looks like the activeSignature parameter is mandatory now in "direct implementation" model, but not mandatory in language-server model - https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#signature-help-request

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.

/cc bambr1975

Activity

  1. dbaeumer commented on Dec 1, 2016

    @dbaeumer
    Member

    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.

  2. nixel2007 commented on Dec 1, 2016

    @nixel2007
    Author

    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?

  3. dbaeumer commented on Dec 1, 2016

    @dbaeumer
    Member

    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.

  4. nixel2007 commented on Dec 1, 2016

    @nixel2007
    Author

    activesignature
    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. =(

  5. dbaeumer commented on Dec 2, 2016

    @dbaeumer
    Member

    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.

  6. KamasamaK commented on Aug 28, 2017

    @KamasamaK

    Dirk Bäumer (@dbaeumer) That would be great. Is there a separate issue for that?

  7. dbaeumer commented on Aug 29, 2017

    @dbaeumer
    Member

    KamasamaK not that I am aware of. Feel free to create one.

  8. locked and limited conversation to collaborators on Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions