This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Fix handling of "empty" language injections with Tree-sitter #21753
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.
Identify the Bug
Fixes #21093
Fixes #20884
Fixes #20897
Fixes atom/language-javascript#676
The Rust grammar had a bug that caused poor error recovery.
There was a bug would occur in documents with language injections, where the injected document is empty. Examples include:
innerHTMLproperty in JavaScript. Usually, we highlight the contents of these strings as HTML.The bug would cause us to accidentally skip highlighting large sections of the document.
Description of the Change
These injected syntax trees are each associated with a Marker in the LanguageMode's
injectionsMarkerLayer. This PR ensures that, when a language injection is empty, its marker is destroyed.I also upgraded to the latest version of
tree-sitter-rustin order to fix the last two issues mentioned in #21093, which were. unrelated, but easy to address.Verification Process
Create files containing all of the code examples in #21093. See that the syntax highlighting is all correct. Edit this files in a variety of ways and see that syntax highlighting stays correct.
Release Notes