Indent on enter from within [], {}, () #208319
Merged
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.
The current auto indent implementation is such that when we click on Enter from within [], {}, (), an indentation is added on the next line only if the opening bracket was adjacent to the closing bracket as follows (here | indicates the cursor position):
In some cases, we want to have the next line indented, even if the brackets are not adjancent. Consider the following case:
In this case when Enter is pressed at the cursor position, we would expect the following indentation to happen:
Instead currently we see this:
This PR aims to address this by introducing extended
onEnterrules where we indent whenever the cursor is located after an opening bracket and is followed by whitespace characters and the corresponding closing bracket.Screen.Recording.2024-03-21.at.17.39.56.mov