Skip to content

fix(highlight): apply parent patterns before nested regions - #4251

Open
chris-paganon wants to merge 1 commit into
micro-editor:masterfrom
chris-paganon:fix/highlighter
Open

chris-paganon wants to merge 1 commit into
micro-editor:masterfrom
chris-paganon:fix/highlighter

Conversation

@chris-paganon

Copy link
Copy Markdown

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:
html-before
html-after

powershell-before powershell-after vue-before vue-after ats-before ats-after

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant