Enable existing commit characters in certain locations where isNewIdentifier is true#59523
Merged
Enable existing commit characters in certain locations where isNewIdentifier is true#59523
isNewIdentifier is true#59523Conversation
isNewIdentifier is true
Member
Author
|
@typescript-bot pack this |
Collaborator
Collaborator
|
Hey @gabritto, I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
andrewbranch
approved these changes
Aug 5, 2024
Member
Author
|
This should be testable using vscode insiders and setting TS to this PR (see this). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #31244.
Fixes #25691.
As I said in #59339, our existing behavior, implemented based on vscode's behavior, is that whenever
isNewIdentifierLocationistrue, we disable all commit characters, otherwise the commit characters are.,,,;.However, there have been issues opened over time that this approach is too conservative.
This PR enables some of the usual commit characters in some places where
isNewIdentifierLocationistrueand that previously we'd enable no commit characters.Mainly, this PR enables all the three commit characters in every position where an expression is expected. In some of those positions, where we are inside an open parenthesis, the user could be typing a parameter list for an arrow expression, so we disable
,as a commit character.I considered adding space as a commit character too, but we would have to disable it pretty much everywhere where
isNewIdentifierLocationistruebecause space could validly follow a new identifier in all of those places, so I figured users wouldn't be able to use it reliably as a commit character and it didn't seem like a good idea.This PR should be testable in vscode insiders once it picks up microsoft/vscode#223541.