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.
This fixes some Matchit edge cases.
Missed jumps on comments
Currently, hitting
%
on the whitespace before a commented pair will not jump. This is a logic bug. When deciding if comments should be included in the search, we need to check the PSI element at the first match offset, not the caret offset.As a bonus, this fix makes the special
isHtmlAttribute
check unnecessary. If the caret is in an HTML attribute, the first match offset will point to the start of the tag.Incorrect jumps on HTML tags sharing a prefix
The regex for HTML jumps needs a closing
>
else a tag like<Box>
will match with e.g.<BoxHeading>
.VIM-2905: Matchit doesnt work with closing JSX tags
In files that mix HTML and JavaScript, like JSX or simple
<script>
tags, the brackets used for arrow functions and comparisons likex > y
conflict with the brackets on tags.To fix that, we can ignore the JS brackets using PSI checks like we currently do for some Ruby keywords.
I double checked that those PSI elements are the same anywhere JavaScript or TypeScript syntax highlighting is used e.g. JSX/TSX, Vue.js etc.
Clip showing the fixed jumps on the example in the ticket: