fix(highlight): apply parent patterns before nested regions - #4251
Open
chris-paganon wants to merge 1 commit into
Open
chris-paganon wants to merge 1 commit into
chris-paganon wants to merge 1 commit into
Conversation
When a child region starts later on a line, apply the current region rules to the preceding text before entering the child. This restores keywords such as import and const before quoted strings without changing the child region or end-of-line state handling.
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.
When a region contains a child region, Micro can miss syntax patterns in the text before that child.
For example, required before a quoted HTML attribute, or import before a string in an embedded script, may receive the region’s default color.
Highlight the prefix using the current parent region’s rules before entering the child region. This also affects nested syntax in templates, string interpolation, and embedded languages; it does not change how top-level regions are entered.
Visually tested before and after with the following languages/frameworks: HTML, Vue, Svelte, Twig, Jinja2, ATS, PowerShell, Crystal, Groovy, and Stata.
Here are some samples:

