fix(highlight): account for multiple rows in highlight testing assertions#4333
Merged
WillLillis merged 2 commits intotree-sitter:masterfrom Apr 6, 2025
Merged
fix(highlight): account for multiple rows in highlight testing assertions#4333WillLillis merged 2 commits intotree-sitter:masterfrom
WillLillis merged 2 commits intotree-sitter:masterfrom
Conversation
clason
approved these changes
Apr 6, 2025
Member
Author
|
The tree-sitter-lua test case you mentioned passes with these changes as well. I'm not sure if it should be though. Edit It definitely seems to be similar-ish to the tree-sitter-vim issue. The |
Contributor
|
Yeah, that seems like a different error (that it passes)? (Possibly the arrow tests are more broadly bugged.) |
Contributor
|
Ah, no, I see now why the test should pass -- it's explicitly testing that the node extends across lines. (Bit of a weird test, tho.) So these changes are good! |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
13 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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 highlight test case is currently broken:
I believe the issue is that the
line_continuation_commentnode starts at position [0,4], rather than [1,0]. This starting position causes this if block to incorrectly enter. Even though the highlight's column is past the position's end column, the highlight starts a row earlier. The fix is to just make sure the highlight's row is considered in addition to the column.Bonus commit: Noticed this while debugging this issue. When zero test cases are parsed, "NaN%" is displayed for the success percentage and "0 bytes/ms" is shown for the parse rate. When no (measured) parsing took place, we don't have a valid success or parse rates to display. N/A seems more correct in this case.
cc @clason