Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lowercase-style-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro-vscode': patch
---

Fix syntax highlighting for lowercase component tags that start with "style" or "script".
8 changes: 5 additions & 3 deletions packages/language-tools/vscode/syntaxes/astro.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "Astro",
"scopeName": "source.astro",
"fileTypes": ["astro"],
"fileTypes": [
"astro"
],
"injections": {
"L:(meta.script.astro) (meta.lang.json) - (meta source)": {
"patterns": [
Expand Down Expand Up @@ -750,7 +752,7 @@
]
},
"tags-lang": {
"begin": "<(script|style)",
"begin": "<(script|style)(?=\\s|/?>)",
"end": "</\\1\\s*>|/>",
"beginCaptures": {
"0": {
Expand Down Expand Up @@ -892,4 +894,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ repository:

# Language tags - they are handled differently for the purposes of language injection.
tags-lang:
begin: <(script|style)
begin: <(script|style)(?=\s|/?>)
end: </\1\s*>|/>
beginCaptures: { 0: { patterns: [include: '#tags-start-node'] } }
endCaptures: { 0: { patterns: [include: '#tags-end-node'] } }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
const label = "Click Me";
---

<styled.button>{label}</styled.button>
<div>After</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
>---
#^^^ source.astro comment
>const label = "Click Me";
#^^^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.block.astro source.ts
>---
#^^^ source.astro comment
>
><styled.button>{label}</styled.button>
#^ source.astro meta.scope.tag.styled.button.astro meta.tag.start.astro punctuation.definition.tag.begin.astro
# ^^^^^^ source.astro meta.scope.tag.styled.button.astro meta.tag.start.astro entity.name.tag.astro
# ^ source.astro meta.scope.tag.styled.button.astro meta.tag.start.astro
# ^^^^^^ source.astro meta.scope.tag.styled.button.astro meta.tag.start.astro entity.name.tag.astro
# ^ source.astro meta.scope.tag.styled.button.astro meta.tag.start.astro punctuation.definition.tag.end.astro
# ^ source.astro punctuation.section.embedded.begin.astro
# ^^^^^ source.astro meta.embedded.expression.astro source.tsx
# ^ source.astro punctuation.section.embedded.end.astro
# ^^ source.astro meta.scope.tag.styled.button.astro meta.tag.end.astro punctuation.definition.tag.begin.astro
# ^^^^^^ source.astro meta.scope.tag.styled.button.astro meta.tag.end.astro entity.name.tag.astro
# ^ source.astro meta.scope.tag.styled.button.astro meta.tag.end.astro
# ^^^^^^ source.astro meta.scope.tag.styled.button.astro meta.tag.end.astro entity.name.tag.astro
# ^ source.astro meta.scope.tag.styled.button.astro meta.tag.end.astro punctuation.definition.tag.end.astro
><div>After</div>
#^ source.astro meta.scope.tag.div.astro meta.tag.start.astro punctuation.definition.tag.begin.astro
# ^^^ source.astro meta.scope.tag.div.astro meta.tag.start.astro entity.name.tag.astro
# ^ source.astro meta.scope.tag.div.astro meta.tag.start.astro punctuation.definition.tag.end.astro
# ^^^^^ source.astro text.astro
# ^^ source.astro meta.scope.tag.div.astro meta.tag.end.astro punctuation.definition.tag.begin.astro
# ^^^ source.astro meta.scope.tag.div.astro meta.tag.end.astro entity.name.tag.astro
# ^ source.astro meta.scope.tag.div.astro meta.tag.end.astro punctuation.definition.tag.end.astro
>