[Draft] Improve % motion by using vscode editor.jumpToBracket #9378
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.
Using % motion on brackets doesn't work properly if there are unmatched brackets in comments
The % motion with
editor.jumpToBracket
was also discussed in (#651). The motion didn't work properly with multicursor before, and this PR doesn't address this particular issue.I also remember an issue talking specifically about the unmatched bracket but I cannot find it.
This PR calls
editor.jumpToBracket
in the case of bracket matching without selection. I tried to make it work with selection, but the command doesn't move the cursor and clears the selection if it exists. Trying to calljumpToBracket
twice in a row when there is a selection, and saving + trying to restore the selection afterward creates a conflict between vscode cursor and vim cursor where they are not at the same location.I would like to make it work with selection in the future but I don't really understand how to fix this yet.
Maybe I should call the editor commands elsewhere than PairMatcher like in the '%' operator somehow ?