microsoft / microsoft/language-server-protocol

completionItem snippets conflict with signatureHelp

Open
#274 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

completion discussion signature help
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CompletionItem and signatureHelp behavior described in the issue, then compare the proposed VSCode-level and LSP-level approaches. Done means an agreed protocol or client behavior activates signatureHelp after a snippet inserts a trigger character, including the Java example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
api, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.