Add range check to highlightsFromCursor#187
Merged
austincondiff merged 2 commits intoCodeEditApp:mainfrom May 10, 2023
Merged
Conversation
Collaborator
Author
|
The build error will be fixed when #186 is merged. |
6 tasks
Collaborator
Author
|
@austincondiff thanks! Just waiting for #186 to pin the STTextView version to fix the build error and this should be mergable. |
matthijseikelenboom
approved these changes
May 10, 2023
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.
Description
Fixes a bug found found by @cengelbart39 on discord where a parser would consume ranges already consumed by injected languages. This caused the injected ranges to be realized as plain text, when they should have been kept as their injected language's highlights.
This should have been avoided by the call to
query.setRange(range)on line 43 in TreeSitterClient+Highlight.swift but it was found that for some reason in the case found by @cengelbart39 it just didn't work.To fix, an additional check was added in
highlightsFromCursorto only take any ranges that have indices in the intersection of it's range and the included range.Related Issues
Checklist
Screenshots
Before:
Screen_Recording_2023-05-04_at_11.00.00_AM.mov
After:
Screen.Recording.2023-05-07.at.2.04.46.PM.mov