Skip to content

Respect multiline lang attributes in syntax highlighting - #17792

Merged
matthewp merged 1 commit into
mainfrom
fix/multiline-lang-highlighting
Aug 24, 2026
Merged

Respect multiline lang attributes in syntax highlighting#17792
matthewp merged 1 commit into
mainfrom
fix/multiline-lang-highlighting

Conversation

@matthewp

@matthewp matthewp commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Changes

  • When lang or type appeared on a later line of a <style> or <script> opening tag, VS Code ignored it and highlighted the embedded content as default CSS or JavaScript. Multiline tags now use the requested Sass, TypeScript, JSON-LD, or other language grammar just like single-line tags. Fixes 🐛 BUG: SASS content incorrectly highlighted as CSS syntax when lang='sass' is not on the same line with <style #14657.
  • The TextMate grammar now prescans ordinary opening-tag attributes and applies the language scope when it reaches a complete literal lang or type value. This preserves attribute highlighting without treating dynamic values, unrelated attribute names, or prefixes such as modulex as language selectors.
sass-multiline-fixed

Testing

  • Added multiline Sass and TypeScript grammar fixtures and snapshots covering preceding attributes, default-language fallbacks, JSON-LD and module scripts, quoted and unquoted values, dynamic values, and lookalike attribute names and values.

Docs

  • No docs update needed because this corrects syntax highlighting for already-valid <style> and <script> formatting.

@changeset-bot

changeset-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1927920

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro-vscode Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@matthewp
matthewp merged commit 6a46994 into main Aug 24, 2026
27 checks passed
@matthewp
matthewp deleted the fix/multiline-lang-highlighting branch August 24, 2026 22:07
@astrobot-houston astrobot-houston mentioned this pull request Aug 24, 2026
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.

🐛 BUG: SASS content incorrectly highlighted as CSS syntax when lang='sass' is not on the same line with <style

3 participants