-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TS Server API proposal: Commit Characters #27623
Comments
If there is concern about the cost of computing the commit characters or about returning them on every suggestion, we can return them on |
Something to keep in mind (which I think we've discussed) is the fact that some of the motivating scenarios are just plain bugs (e.g. maybe we shouldn't be providing completions after |
Closing issue. As discussed offline, we lean towards consistency on the commit characters and gather more user data if further changes are necessary. Check commit microsoft/vscode@76885d7 for details. |
Problem
VS Code (and Visual Studio) have the concept of commit characters for suggestions. This is a set of characters that, when typed, accept the current suggestion. For example, a suggestion for a function may treat
(
as a commit character.VS Code currently computes these commit characters itself using the metadata that typescript returns for each completion entry. This has two problems:
This logic is VS Code specific and may be out of sync with how VS and other editors handle commit characters.
There are some cases where it is difficult to determine what the commit characters should be. A classic example is:
Where the user has just typed
.
. Currently we show a suggestion forb
when the user types the.
. If the user then types another.
as part of a spread, we incorrectly end up accepting that completion, which leaves the code as:TypeScript, with its access to the ast, should be able to determine that
.
should not be a commit character in this caseProposal
Introduce the concept of a commit characters to the TypeScript server aAPI. This would be an optional set of characters returned on each
CompletionEntry
:Return these commit characters on completions. Here's an approximation of how VS Code computes commit characters:
.
and;
are commit characters for most completion types except for keywords and a few others.(
and,
are commit characters for variables.isNewIdentifierLocation
is set.The text was updated successfully, but these errors were encountered: