Skip to content

Conversation

@fkatsuhiro
Copy link
Contributor

@fkatsuhiro fkatsuhiro commented Dec 21, 2025

Changes

#14657
Fix syntax highlighting for <style> and <script> tags when followed by a newline.

  • Updated the begin regex in tags-lang to use a multi-line lookahead (?=[\s\S]*?>), ensuring the grammar continues scanning for attributes across line breaks.
  • Replaced line-restricted matchers [^>]? with multi-line matchers [\s\S]? in language identification patterns.
  • Adjusted tags-lang-start-attributes to allow whitespace/newlines between the tag name and its attributes using \G|\s+.

Testing

Docs

@changeset-bot
Copy link

changeset-bot bot commented Dec 21, 2025

⚠️ No Changeset found

Latest commit: 0249158

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@Princesseuh
Copy link
Member

Hello, apologies for the delay! You can test this by creating a new .astro file in packages/language-tools/vscode/test/grammar/fixtures and running the update-grammar-snapshots script from the vscode folder. It'll generate a .snap showing all the scopes applied on the code based on the rules (you can check the other .snap for example, there's already one for sass showing the expected scope inside the style tag)

Make sure to build your grammar before updating the snapshots using the build:grammar or dev:grammar scripts from the vscode package.

As for the current solution you have, it does not strike me as problematic, assuming it works!

@fkatsuhiro
Copy link
Contributor Author

Thank you for the detailed instructions on how to test the grammar changes! I'm also relieved to hear that my current approach seems okay to you.

I will try creating the fixture and running the scripts as you suggested a bit later. I'll get back to you with the results once I've had a chance to verify the snapshots. Thanks again!

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.

2 participants