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:
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:
- VSCode solution: if the character before
$0 in a snippet is a signatureHelp trigger character, activate signatureHelp.
- LSP solution: add a property
CompletionItem { ... activateSignatureHelp: boolean } that activates signature-help immediately following completion.
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:
We would like to autocomplete
someValue.someMethod()and place the users cursor between parentheses. This is possible using snippets: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.someMethodis well-defined as a reference tosomeMethod. But in Java, method references have a different syntaxsomeValue::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:
$0in a snippet is a signatureHelp trigger character, activate signatureHelp.CompletionItem { ... activateSignatureHelp: boolean }that activates signature-help immediately following completion.