Skip to content
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

completionItem snippets conflict with signatureHelp #31290

Closed
georgewfraser opened this issue Jul 24, 2017 · 2 comments
Closed

completionItem snippets conflict with signatureHelp #31290

georgewfraser opened this issue Jul 24, 2017 · 2 comments
Assignees
Labels
api *question Issue represents a question, should be posted to StackOverflow (VS Code) suggest IntelliSense, Auto Complete

Comments

@georgewfraser
Copy link

When implementing a java language server, it would be nice to be able to activate signatureHelp immediately, without a trigger character. Suppose for example the user has typed:

someValue.someMeth

We would like to autocomplete someValue.someMethod() and place the users cursor between parentheses. This is possible using snippets:

CompletionItem { label: someMethod, insertText: someMethod($0), insertTextFormat: 2 }

The problem is that signatureHelp relies on the trigger character (, and it doesn't get activated when the ( is inserted as part of the snippet.

This problem does not come up in languages like Typescript, because the expression someValue.someMethod is well-defined as a reference to someMethod. But in Java, method references have a different syntax someValue::someMethod. So we know the user will always type (, but we don't autocomplete it.

There are two possible solutions to this, one at the VSCode level and one at the language-server-protocol level:

  1. VSCode solution: if the character before $0 in a snippet is a signatureHelp trigger character, activate signatureHelp.
  2. LSP solution: add a property CompletionItem { ... activateSignatureHelp: boolean } that activates signature-help immediately following completion.

I filed a corresponding issue in the language-server-protocol repo: microsoft/language-server-protocol#274

@jrieken
Copy link
Member

jrieken commented Jul 24, 2017

This should work when using the completion item command. Set it to editor.action.triggerParameterHints and the editor will trigger signature help after inserting the completion

@georgewfraser
Copy link
Author

Thank you! Works great:

Autocomplete

It was not obvious to me from the language-server-protocol docs that I could execute built-in commands, perhaps the documentation could be improved a bit.

@jrieken jrieken added *question Issue represents a question, should be posted to StackOverflow (VS Code) suggest IntelliSense, Auto Complete labels Jul 25, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api *question Issue represents a question, should be posted to StackOverflow (VS Code) suggest IntelliSense, Auto Complete
Projects
None yet
Development

No branches or pull requests

2 participants