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 highlightsFromCursor to only take any ranges that have indices in the intersection of it's range and the included range.
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
highlightsFromCursor
to only take any ranges that have indices in the intersection of it's range and the included range.Related Issues
Checklist
Screenshots
Before:
https://user-images.githubusercontent.com/35942988/236696171-d30dfd7b-8545-4396-8aa8-490ceac65551.mov
After:
https://user-images.githubusercontent.com/35942988/236697575-3f605c0d-3dda-45c2-8f69-0f41148f1c2d.mov