Better change tracking for Semantic highlighting for CSL #8099
+82
−114
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.
Instead of tracking changes in a series of
Edit
records between parsing there could be DocumentPosition
used, which automatically track the offset changes in the edited document.This version further simplifies the highlighter.
Also resolves a minor issue, that would not extend the previous highlight when the new text is just appended after a whole token.
Before:
Screencast From 2024-12-29 15-53-25.webm
After:
Screencast From 2024-12-29 15-50-57.webm
This may have better performance as well. There was some minor flickering on highlights when the edit list grew "large" (basically that needed a lot of monkey style keyboard clamping, to be noticeable)
I have a minor aversion to put Position which is a mutable thing info the
SequenceElement
record, though it is used to grouping data together, also changes in the document, shall not change the order of the instances when put in a collection, so I could live with that. Please tell me if you have something better in mind.