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/AGENTS.md b/AGENTS.md index 991ea5b448e4..6fa7e6a74b66 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,18 +37,12 @@ Note: Edits to source files take effect after rebuilding the package via `pnpm b # Running Tests -- Run `pnpm test` in workspace root or package directory to run full test suite (can be slow!) -- Integration tests live in special `packages/integrations` folders. -- Example: `pnpm -C astro-scripts test` - Run a single package test suite -- Example: `pnpm -C astro-scripts test "test/actions.test.js"` - Run a single test file -- Example: `pnpm -C astro-scripts test "test/**/*.test.js" --match "CSS"` - Run specific tests matching a string or regex patterns -- Example: `pnpm -C astro-scripts test "test/{actions,css,middleware}.test.js"` - Run multiple test files -- Key flags: - - `--match` / `-m`: Filter tests by name pattern (regex) - - `--only` / `-o`: Run only tests marked with `.only` - - `--parallel` / `-p`: Run tests in parallel (default is sequential) - - `--timeout` / `-t`: Set timeout in milliseconds - - `--watch` / `-w`: Watch mode +- Run `pnpm test` in the workspace root to run the full suite (slow). +- Run `pnpm -C test` to run a package’s tests (example: `pnpm -C packages/astro test`, `pnpm -C packages/integrations/react test`). +- Run an individual test file with `node path/to/test.js` (non-E2E). +- For focused Astro package runs: `pnpm -C packages/astro test:unit`, `pnpm -C packages/astro test:integration`, `pnpm -C packages/astro test:cli`, `pnpm -C packages/astro test:types`. +- For matching a subset by test name in Astro: `pnpm -C packages/astro test:match -- ""`. +- For E2E: `pnpm test:e2e` or `pnpm test:e2e:match -- ""`. # Astro Quick Reference diff --git a/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json b/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json index 959902a92a5f..931508b706f3 100644 --- a/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json +++ b/packages/language-tools/vscode/syntaxes/astro.tmLanguage.json @@ -750,7 +750,7 @@ ] }, "tags-lang": { - "begin": "<(script|style)", + "begin": "<(script|style)(?=\\s|/?>)", "end": "|/>", "beginCaptures": { "0": { 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: |/> 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