diff --git a/.changeset/lowercase-style-tags.md b/.changeset/lowercase-style-tags.md
new file mode 100644
index 000000000000..12e01671afc4
--- /dev/null
+++ b/.changeset/lowercase-style-tags.md
@@ -0,0 +1,5 @@
+---
+'astro-vscode': patch
+---
+
+Fix syntax highlighting for lowercase component tags that start with "style" or "script".
diff --git a/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json b/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json
index 959902a92a5f..4c844a608f23 100644
--- a/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json
+++ b/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json
@@ -1,7 +1,9 @@
{
"name": "Astro",
"scopeName": "source.astro",
- "fileTypes": ["astro"],
+ "fileTypes": [
+ "astro"
+ ],
"injections": {
"L:(meta.script.astro) (meta.lang.json) - (meta source)": {
"patterns": [
@@ -750,7 +752,7 @@
]
},
"tags-lang": {
- "begin": "<(script|style)",
+ "begin": "<(script|style)(?=\\s|/?>)",
"end": "\\1\\s*>|/>",
"beginCaptures": {
"0": {
@@ -892,4 +894,4 @@
]
}
}
-}
+}
\ No newline at end of file
diff --git a/packages/language-tools/vscode/syntaxes/astro.tmLanguage.src.yaml b/packages/language-tools/vscode/syntaxes/astro.tmLanguage.src.yaml
index 197695cbbd5c..e0a99a2a5e17 100644
--- a/packages/language-tools/vscode/syntaxes/astro.tmLanguage.src.yaml
+++ b/packages/language-tools/vscode/syntaxes/astro.tmLanguage.src.yaml
@@ -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'] } }
diff --git a/packages/language-tools/vscode/test/grammar/fixtures/components/lowercase-style-prefix.astro b/packages/language-tools/vscode/test/grammar/fixtures/components/lowercase-style-prefix.astro
new file mode 100644
index 000000000000..c27093c571f6
--- /dev/null
+++ b/packages/language-tools/vscode/test/grammar/fixtures/components/lowercase-style-prefix.astro
@@ -0,0 +1,6 @@
+---
+const label = "Click Me";
+---
+
+{label}
+
After
diff --git a/packages/language-tools/vscode/test/grammar/fixtures/components/lowercase-style-prefix.astro.snap b/packages/language-tools/vscode/test/grammar/fixtures/components/lowercase-style-prefix.astro.snap
new file mode 100644
index 000000000000..1ec086adf0cd
--- /dev/null
+++ b/packages/language-tools/vscode/test/grammar/fixtures/components/lowercase-style-prefix.astro.snap
@@ -0,0 +1,30 @@
+>---
+#^^^ source.astro comment
+>const label = "Click Me";
+#^^^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.block.astro source.ts
+>---
+#^^^ source.astro comment
+>
+>{label}
+#^ 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
+>After
+#^ 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
+>
\ No newline at end of file