Astro Info
Astro v6.3.3
Vite v7.3.3
Node v24.15.0
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
All
Describe the Bug
Package: @astrojs/language-server
Repo: withastro/language-tools
Description
Using @property inside a <style> block causes the language server to incorrectly
tokenize the rest of the .astro file. The closing </style> tag loses its syntax
highlighting, and all subsequent <script> and <style> blocks are highlighted
incorrectly as well.
This does not happen in Zed, which suggests the issue is specific to the
@astrojs/language-server used by the VS Code extension.
Steps to Reproduce
Create an .astro file with the following content:
<script>
console.log(window);
</script>
<style>
@property --logo-color {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
</style>
<style>
div {
background: red;
}
</style>
<script>
console.log(window);
function testFunc() {
console.log("test");
}
testFunc();
</script>
Actual Behavior
- The closing
</style> tag after the @property block loses correct highlighting
- All subsequent
<style> and <script> blocks (both content and tags) are
incorrectly highlighted
- Subsequent
</style> closing tags are also affected
Environment
- VS Code version: 1.120
- Astro VS Code extension (
astro-vscode) version: 2.16.14
Additional Context
The issue does not reproduce in Zed editor, indicating this is specific to the
language server's tokenizer/parser, not a general CSS grammar issue.
Confirmed on both Linux and Windows, so this is not OS-specific.
VSCode Picture with at-property:
VSCode Picture without at-property:
What's the expected result?
All <style> and <script> blocks are highlighted correctly regardless of
@property usage.
Link to Minimal Reproducible Example
https://github.com/PanRoR/astro-at-property-highlighting
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
All
Describe the Bug
Package:
@astrojs/language-serverRepo:
withastro/language-toolsDescription
Using
@propertyinside a<style>block causes the language server to incorrectlytokenize the rest of the
.astrofile. The closing</style>tag loses its syntaxhighlighting, and all subsequent
<script>and<style>blocks are highlightedincorrectly as well.
This does not happen in Zed, which suggests the issue is specific to the
@astrojs/language-serverused by the VS Code extension.Steps to Reproduce
Create an
.astrofile with the following content:Actual Behavior
</style>tag after the@propertyblock loses correct highlighting<style>and<script>blocks (both content and tags) areincorrectly highlighted
</style>closing tags are also affectedEnvironment
astro-vscode) version: 2.16.14Additional Context
The issue does not reproduce in Zed editor, indicating this is specific to the
language server's tokenizer/parser, not a general CSS grammar issue.
Confirmed on both Linux and Windows, so this is not OS-specific.
VSCode Picture with at-property:
VSCode Picture without at-property:
What's the expected result?
All
<style>and<script>blocks are highlighted correctly regardless of@propertyusage.Link to Minimal Reproducible Example
https://github.com/PanRoR/astro-at-property-highlighting
Participation