Repository navigation
fix: show the semantic tokens in the text they were computed for, and keep the place of the inspector - #2047
Merged
lagergren merged 1 commit intoNov 20, 2026
Conversation
… keep the place of the inspector Fixes redhat-developer#399, fixes redhat-developer#400. - redhat-developer#399: the semantic tokens inspector inserted its tags at the offsets of the tokens into the text that the document had when the inspector showed them, later than the tokens were computed. After an edit, as typing or an undo, the offsets were in another text, and the inspector threw `IndexOutOfBoundsException: Wrong offset`. `SemanticTokensInspectorData` now keeps the text of the document when it is created with the tokens, and the inspector inserts the tags into that text. A token outside the text, as one with a large value from a server, is not shown, instead of failing the whole view. - redhat-developer#400: each refresh set the text of the inspector, which moved its caret to the end of the new text, so the view scrolled to the bottom. Its caret no longer follows the changes of the text, so the view stays where the user left it. Test: `SemanticTokensInspectorTest` shows tokens after the document has changed, shows a token outside the text, and refreshes the text of the inspector's editor. Without the change, the first two throw `IndexOutOfBoundsException: Wrong offset`, and the third finds the caret at the end of the text.
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2047 +/- ##
==========================================
- Coverage 49.44% 49.44% -0.01%
==========================================
Files 813 813
Lines 33324 33330 +6
Branches 5191 5193 +2
==========================================
+ Hits 16478 16479 +1
- Misses 14272 14280 +8
+ Partials 2574 2571 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@coderabbitai review |
Action performed
|
This was referenced Nov 24, 2026
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.
Fixes #399, fixes #400.
of the tokens into the text that the document had when the inspector
showed them, later than the tokens were computed. After an edit, as
typing or an undo, the offsets were in another text, and the
inspector threw
IndexOutOfBoundsException: Wrong offset.SemanticTokensInspectorDatanow keeps the text of the document whenit is created with the tokens, and the inspector inserts the tags into
that text. A token outside the text, as one with a large value from a
server, is not shown, instead of failing the whole view.
caret to the end of the new text, so the view scrolled to the bottom.
Its caret no longer follows the changes of the text, so the view stays
where the user left it.
Test:
SemanticTokensInspectorTestshows tokens after the document haschanged, shows a token outside the text, and refreshes the text of the
inspector's editor. Without the change, the first two throw
IndexOutOfBoundsException: Wrong offset, and the third finds the caretat the end of the text.