From fec2817aee54193ddf98ca714f4a8e4425c58bf3 Mon Sep 17 00:00:00 2001
From: Erika <3019731+Princesseuh@users.noreply.github.com>
Date: Fri, 20 May 2022 17:07:02 -0400
Subject: [PATCH] Syntax and language configuration fixes and improvements
(#286)
---
.changeset/selfish-icons-breathe.md | 5 +
.../astro-language-configuration.json | 39 ++++-
packages/vscode/package.json | 9 +-
.../vscode/syntaxes/astro.tmLanguage.json | 160 +++++++++++++++---
packages/vscode/test/grammar/README.md | 5 +
.../grammar/dummy/css.tmLanguage-dummy.json | 4 +
.../grammar/dummy/html.tmLanguage-dummy.json | 4 +
.../grammar/dummy/js.tmLanguage-dummy.json | 4 +
.../grammar/dummy/json.tmLanguage-dummy.json | 4 +
.../grammar/dummy/less.tsLanguage-dummy.json | 4 +
.../dummy/markdown.tmLanguage-dummy.json | 4 +
.../grammar/dummy/sass.tmLanguage-dummy.json | 4 +
.../grammar/dummy/scss.tsLanguage-dummy.json | 4 +
.../dummy/stylus.tmLanguage-dummy.json | 4 +
.../grammar/dummy/ts.tmLanguage-dummy.json | 4 +
.../grammar/dummy/tsx.tmLanguage-dummy.json | 4 +
.../dummy/unknown.tmLanguage-dummy.json | 4 +
.../fixtures/components/component.astro | 3 +
.../fixtures/components/component.astro.snap | 17 ++
.../grammar/fixtures/markdown/markdown.astro | 7 +
.../fixtures/markdown/markdown.astro.snap | 18 ++
.../test/grammar/fixtures/raw/israw.astro | 15 ++
.../grammar/fixtures/raw/israw.astro.snap | 68 ++++++++
.../test/grammar/fixtures/script/israw.astro | 3 +
.../grammar/fixtures/script/israw.astro.snap | 13 ++
.../test/grammar/fixtures/script/json.astro | 14 ++
.../grammar/fixtures/script/json.astro.snap | 39 +++++
.../grammar/fixtures/script/jstypes.astro | 15 ++
.../fixtures/script/jstypes.astro.snap | 68 ++++++++
.../test/grammar/fixtures/script/module.astro | 3 +
.../grammar/fixtures/script/module.astro.snap | 17 ++
.../test/grammar/fixtures/script/script.astro | 3 +
.../grammar/fixtures/script/script.astro.snap | 11 ++
.../grammar/fixtures/script/unknowntype.astro | 3 +
.../fixtures/script/unknowntype.astro.snap | 17 ++
.../test/grammar/fixtures/style/israw.astro | 5 +
.../grammar/fixtures/style/israw.astro.snap | 17 ++
.../test/grammar/fixtures/style/less.astro | 9 +
.../grammar/fixtures/style/less.astro.snap | 28 +++
.../test/grammar/fixtures/style/sass.astro | 8 +
.../grammar/fixtures/style/sass.astro.snap | 26 +++
.../test/grammar/fixtures/style/scss.astro | 9 +
.../grammar/fixtures/style/scss.astro.snap | 28 +++
.../test/grammar/fixtures/style/style.astro | 3 +
.../grammar/fixtures/style/style.astro.snap | 11 ++
.../test/grammar/fixtures/style/stylus.astro | 9 +
.../grammar/fixtures/style/stylus.astro.snap | 38 +++++
packages/vscode/test/grammar/test.mjs | 55 ++++++
packages/vscode/test/tsconfig.json | 13 ++
packages/vscode/tsconfig.base.json | 17 --
yarn.lock | 42 ++++-
51 files changed, 869 insertions(+), 49 deletions(-)
create mode 100644 .changeset/selfish-icons-breathe.md
create mode 100644 packages/vscode/test/grammar/README.md
create mode 100644 packages/vscode/test/grammar/dummy/css.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/html.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/js.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/json.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/less.tsLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/markdown.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/sass.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/scss.tsLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/stylus.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/ts.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/tsx.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/dummy/unknown.tmLanguage-dummy.json
create mode 100644 packages/vscode/test/grammar/fixtures/components/component.astro
create mode 100644 packages/vscode/test/grammar/fixtures/components/component.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/markdown/markdown.astro
create mode 100644 packages/vscode/test/grammar/fixtures/markdown/markdown.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/raw/israw.astro
create mode 100644 packages/vscode/test/grammar/fixtures/raw/israw.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/script/israw.astro
create mode 100644 packages/vscode/test/grammar/fixtures/script/israw.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/script/json.astro
create mode 100644 packages/vscode/test/grammar/fixtures/script/json.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/script/jstypes.astro
create mode 100644 packages/vscode/test/grammar/fixtures/script/jstypes.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/script/module.astro
create mode 100644 packages/vscode/test/grammar/fixtures/script/module.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/script/script.astro
create mode 100644 packages/vscode/test/grammar/fixtures/script/script.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/script/unknowntype.astro
create mode 100644 packages/vscode/test/grammar/fixtures/script/unknowntype.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/style/israw.astro
create mode 100644 packages/vscode/test/grammar/fixtures/style/israw.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/style/less.astro
create mode 100644 packages/vscode/test/grammar/fixtures/style/less.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/style/sass.astro
create mode 100644 packages/vscode/test/grammar/fixtures/style/sass.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/style/scss.astro
create mode 100644 packages/vscode/test/grammar/fixtures/style/scss.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/style/style.astro
create mode 100644 packages/vscode/test/grammar/fixtures/style/style.astro.snap
create mode 100644 packages/vscode/test/grammar/fixtures/style/stylus.astro
create mode 100644 packages/vscode/test/grammar/fixtures/style/stylus.astro.snap
create mode 100644 packages/vscode/test/grammar/test.mjs
create mode 100644 packages/vscode/test/tsconfig.json
delete mode 100644 packages/vscode/tsconfig.base.json
diff --git a/.changeset/selfish-icons-breathe.md b/.changeset/selfish-icons-breathe.md
new file mode 100644
index 00000000..02905784
--- /dev/null
+++ b/.changeset/selfish-icons-breathe.md
@@ -0,0 +1,5 @@
+---
+'astro-vscode': patch
+---
+
+Improved syntax highlighting, auto-indentation and auto-closing
diff --git a/packages/vscode/languages/astro-language-configuration.json b/packages/vscode/languages/astro-language-configuration.json
index 5e761af0..99ad2474 100644
--- a/packages/vscode/languages/astro-language-configuration.json
+++ b/packages/vscode/languages/astro-language-configuration.json
@@ -3,11 +3,9 @@
"blockComment": [""]
},
"brackets": [
- ["---", "---"],
[""],
["<", ">"],
- ["{", "}"],
- ["(", ")"]
+ ["{", "}"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
@@ -16,13 +14,15 @@
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "`", "close": "`" },
- { "open": "", "notIn": ["comment", "string"] },
+ { "open": "{/*", "close": " */}", "notIn": ["comment", "string"] },
+ { "open": "", "notIn": ["comment", "string"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
"autoCloseBefore": ";:.,=}])>` \n\t",
"surroundingPairs": [
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
+ { "open": "`", "close": "`" },
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
@@ -33,5 +33,36 @@
"start": "^\\s*",
"end": "^\\s*"
}
+ },
+ "wordPattern": {
+ "pattern": "([^\\-\\s]+-[^\\-\\s]+)|(-?\\d*\\.\\d\\w*)|([^\\`\\~\\-\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:'\"\\,\\.\\<\\>\\/\\s]+)"
+ },
+ "onEnterRules": [
+ {
+ "beforeText": {
+ "pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!/)>)[^<]*$",
+ "flags": "i"
+ },
+ "afterText": {
+ "pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>$",
+ "flags": "i"
+ },
+ "action": {
+ "indent": "indentOutdent"
+ }
+ },
+ {
+ "beforeText": {
+ "pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!/)>)[^<]*$",
+ "flags": "i"
+ },
+ "action": {
+ "indent": "indent"
+ }
+ }
+ ],
+ "indentationRules": {
+ "increaseIndentPattern": "<(?!\\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr)\\b|[^>]*\\/>)([-_\\.A-Za-z0-9]+)(?=\\s|>)\\b[^>]*>(?!.*<\\/\\1>)|)|\\{[^}\"']*$",
+ "decreaseIndentPattern": "^\\s*(<\\/(?!html)[-_\\.A-Za-z0-9]+\\b[^>]*>|-->|\\})"
}
}
diff --git a/packages/vscode/package.json b/packages/vscode/package.json
index a30d58cd..f8dedf36 100644
--- a/packages/vscode/package.json
+++ b/packages/vscode/package.json
@@ -16,7 +16,10 @@
"vscode:prepublish": "yarn build",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
"dev": "astro-scripts dev \"src/**/*.ts\"",
- "test": "node ./test/runTest.js"
+ "test": "yarn run test:vscode && yarn run test:grammar",
+ "test:vscode": "node ./test/runTest.js",
+ "test:grammar": "node ./test/grammar/test.mjs",
+ "update-grammar-snapshots": "node ./test/grammar/test.mjs --updateSnapshot"
},
"engines": {
"vscode": "^1.67.0"
@@ -28,7 +31,8 @@
"dependencies": {
"@astrojs/language-server": "0.19.0",
"@astrojs/ts-plugin": "0.2.1",
- "vscode-languageclient": "^8.0.1"
+ "vscode-languageclient": "^8.0.1",
+ "vscode-tmgrammar-test": "^0.1.1"
},
"devDependencies": {
"@types/glob": "^7.2.0",
@@ -252,6 +256,7 @@
"source.stylus": "stylus",
"source.js": "javascript",
"source.ts": "typescript",
+ "source.json": "json",
"source.tsx": "typescriptreact"
}
},
diff --git a/packages/vscode/syntaxes/astro.tmLanguage.json b/packages/vscode/syntaxes/astro.tmLanguage.json
index e19e4346..c93486dd 100644
--- a/packages/vscode/syntaxes/astro.tmLanguage.json
+++ b/packages/vscode/syntaxes/astro.tmLanguage.json
@@ -68,25 +68,64 @@
]
},
"astro:component": {
- "name": "meta.tag.component.astro",
- "begin": "(?)([$A-Z_][^/?!\\s<>]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)\\b",
- "beginCaptures": {
- "1": {
- "name": "punctuation.definition.tag.begin.astro"
- },
- "2": {
- "name": "entity.name.tag.astro support.class.component.astro"
- }
- },
- "end": "(/?>)",
- "endCaptures": {
- "1": {
- "name": "punctuation.definition.tag.end.astro"
- }
- },
"patterns": [
{
- "include": "#astro:attribute"
+ "name": "meta.tag.component.astro astro.component.raw",
+ "begin": "(<)([$A-Z_][^/?!\\s<>]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)(.+is:raw.*?)(>)",
+ "end": "()([$A-Z_][^/?!\\s<>]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)(?=\\s|/?>)(>)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.tag.begin.astro"
+ },
+ "2": {
+ "name": "entity.name.tag.astro support.class.component.astro"
+ },
+ "3": {
+ "patterns": [
+ {
+ "include": "#astro:attribute"
+ }
+ ]
+ },
+ "4": {
+ "name": "punctuation.definition.tag.end.astro"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.definition.tag.begin.astro"
+ },
+ "2": {
+ "name": "entity.name.tag.astro support.class.component.astro"
+ },
+ "3": {
+ "name": "punctuation.definition.tag.end.astro"
+ }
+ },
+ "contentName": "source.unknown"
+ },
+ {
+ "name": "meta.tag.component.astro",
+ "begin": "(?)([$A-Z_][^/?!\\s<>]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)\\b",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.tag.begin.astro"
+ },
+ "2": {
+ "name": "entity.name.tag.astro support.class.component.astro"
+ }
+ },
+ "end": "(/?>)",
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.definition.tag.end.astro"
+ }
+ },
+ "patterns": [
+ {
+ "include": "#astro:attribute"
+ }
+ ]
}
]
},
@@ -131,6 +170,47 @@
}
},
"patterns": [
+ {
+ "comment": "Treat script tag with application/ld+json as JSON. This needs to be higher than is:raw since it's a very possible situation to have is:raw on a JSON script tag",
+ "begin": "\\G(?=\\s*[^>]*?type\\s*=\\s*(['\"]|)(?i:application/ld\\+json)\\1)",
+ "end": "(?=|/>)",
+ "patterns": [
+ {
+ "begin": "(?<=>)(?!)",
+ "end": "(?=)",
+ "contentName": "source.json",
+ "patterns": [{ "include": "source.json" }]
+ },
+ { "include": "#html:tag-attributes" }
+ ]
+ },
+ {
+ "comment": "Treat script tag with JS-compatible types as JS",
+ "begin": "\\G(?=\\s*[^>]*?type\\s*=\\s*(['\"]|)(?i:module|(?:text/javascript|text/partytown|application/node|application/javascript))\\1)",
+ "end": "(?=|/>)",
+ "patterns": [
+ {
+ "begin": "(?<=>)(?!)",
+ "end": "(?=)",
+ "contentName": "source.js",
+ "patterns": [{ "include": "source.js" }]
+ },
+ { "include": "#html:tag-attributes" }
+ ]
+ },
+ {
+ "comment": "Treat anything with an unknown type as unknown",
+ "begin": "\\G(?=\\s*[^>]*?type\\s*=\\s*(['\"]|)\\1)",
+ "end": "(?=|/>)",
+ "patterns": [
+ {
+ "begin": "(?<=>)(?!)",
+ "end": "(?=)",
+ "name": "source.unknown"
+ },
+ { "include": "#html:tag-attributes" }
+ ]
+ },
{
"begin": "\\G(?=\\s*[^>]*?lang\\s*=\\s*(['\"]|)(?i:jsx?|javascript)\\1)",
"end": "(?=|/>)",
@@ -367,6 +447,41 @@
},
"html:element": {
"patterns": [
+ {
+ "name": "astro.element.raw",
+ "begin": "(<)([^/?!\\s<>]+)(.+is:raw.*?)(>)",
+ "end": "()([^/?!\\s<>]+)(?=\\s|/?>)(>)",
+ "beginCaptures": {
+ "1": {
+ "name": "punctuation.definition.tag.begin.html"
+ },
+ "2": {
+ "name": "entity.name.tag.html"
+ },
+ "3": {
+ "patterns": [
+ {
+ "include": "#astro:attribute"
+ }
+ ]
+ },
+ "4": {
+ "name": "punctuation.definition.tag.end.html"
+ }
+ },
+ "endCaptures": {
+ "1": {
+ "name": "punctuation.definition.tag.begin.html"
+ },
+ "2": {
+ "name": "entity.name.tag.html"
+ },
+ "3": {
+ "name": "punctuation.definition.tag.end.html"
+ }
+ },
+ "contentName": "source.unknown"
+ },
{
"name": "meta.tag.any.$2.start.html",
"begin": "(<)([^/?!\\s<>]+)(?=\\s|/?>)",
@@ -445,16 +560,16 @@
"begin": "\\{",
"beginCaptures": {
"0": {
- "name": "punctuation.definition.generic.begin.html"
+ "name": "punctuation.section.embedded.begin.tsx"
}
},
"end": "\\}",
"endCaptures": {
"0": {
- "name": "punctuation.definition.generic.end.html"
+ "name": "punctuation.section.embedded.end.tsx"
}
},
- "name": "expression.embbeded.astro",
+ "name": "expression.embedded.astro",
"contentName": "source.tsx",
"patterns": [
{
@@ -500,10 +615,11 @@
]
},
"frontmatter": {
+ "comment": "The frontmatter is treated as comments in order to get the \"faded\" look",
"begin": "\\A(-{3})\\s*$",
"beginCaptures": {
"1": {
- "name": "comment.block.html"
+ "name": "comment"
}
},
"contentName": "source.ts",
@@ -515,7 +631,7 @@
"end": "(^|\\G)(-{3})|\\.{3}\\s*$",
"endCaptures": {
"2": {
- "name": "comment.block.html"
+ "name": "comment"
}
}
},
diff --git a/packages/vscode/test/grammar/README.md b/packages/vscode/test/grammar/README.md
new file mode 100644
index 00000000..7ef36734
--- /dev/null
+++ b/packages/vscode/test/grammar/README.md
@@ -0,0 +1,5 @@
+# Testing syntax files
+
+This is a testing setup powered by [vscode-tmgrammar-test](https://github.com/PanAeon/vscode-tmgrammar-test) intended to test our `astro.tmLanguage.json` file to make sure it properly handle `.astro` files. To run it, simply run the `test:grammar` npm script from the repo
+
+[Snapshots](https://github.com/PanAeon/vscode-tmgrammar-test#snapshot-tests) can be updated using the `update-grammar-snapshots` npm script, however, unless your changes affect the currently present snapshots, you should always make sure to run the tests (`yarn run test:grammar`) before updating the snapshots, to make sure your changes do not introduce regressions
diff --git a/packages/vscode/test/grammar/dummy/css.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/css.tmLanguage-dummy.json
new file mode 100644
index 00000000..5e6df8ec
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/css.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy CSS TextMate grammar for use in testing",
+ "scopeName": "source.css"
+}
diff --git a/packages/vscode/test/grammar/dummy/html.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/html.tmLanguage-dummy.json
new file mode 100644
index 00000000..633cbb58
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/html.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy HTML TextMate grammar for use in testing",
+ "scopeName": "text.html"
+}
diff --git a/packages/vscode/test/grammar/dummy/js.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/js.tmLanguage-dummy.json
new file mode 100644
index 00000000..ac9f4a19
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/js.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy JS TextMate grammar for use in testing",
+ "scopeName": "source.js"
+}
diff --git a/packages/vscode/test/grammar/dummy/json.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/json.tmLanguage-dummy.json
new file mode 100644
index 00000000..293c33fd
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/json.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy JSON TextMate grammar for use in testing",
+ "scopeName": "source.json"
+}
diff --git a/packages/vscode/test/grammar/dummy/less.tsLanguage-dummy.json b/packages/vscode/test/grammar/dummy/less.tsLanguage-dummy.json
new file mode 100644
index 00000000..e8119462
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/less.tsLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy Less TextMate grammar for use in testing",
+ "scopeName": "source.css.less"
+}
diff --git a/packages/vscode/test/grammar/dummy/markdown.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/markdown.tmLanguage-dummy.json
new file mode 100644
index 00000000..83a66252
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/markdown.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy Markdown TextMate grammar for use in testing",
+ "scopeName": "text.html.markdown"
+}
diff --git a/packages/vscode/test/grammar/dummy/sass.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/sass.tmLanguage-dummy.json
new file mode 100644
index 00000000..ae0671ad
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/sass.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy Sass TextMate grammar for use in testing",
+ "scopeName": "source.sass"
+}
diff --git a/packages/vscode/test/grammar/dummy/scss.tsLanguage-dummy.json b/packages/vscode/test/grammar/dummy/scss.tsLanguage-dummy.json
new file mode 100644
index 00000000..197230d2
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/scss.tsLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy Scss TextMate grammar for use in testing",
+ "scopeName": "source.css.scss"
+}
diff --git a/packages/vscode/test/grammar/dummy/stylus.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/stylus.tmLanguage-dummy.json
new file mode 100644
index 00000000..995e0701
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/stylus.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy Stylus TextMate grammar for use in testing",
+ "scopeName": "source.stylus"
+}
diff --git a/packages/vscode/test/grammar/dummy/ts.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/ts.tmLanguage-dummy.json
new file mode 100644
index 00000000..1a208803
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/ts.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy TS TextMate grammar for use in testing",
+ "scopeName": "source.ts"
+}
diff --git a/packages/vscode/test/grammar/dummy/tsx.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/tsx.tmLanguage-dummy.json
new file mode 100644
index 00000000..2918d4c1
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/tsx.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy TSX TextMate grammar for use in testing",
+ "scopeName": "source.tsx"
+}
diff --git a/packages/vscode/test/grammar/dummy/unknown.tmLanguage-dummy.json b/packages/vscode/test/grammar/dummy/unknown.tmLanguage-dummy.json
new file mode 100644
index 00000000..4f2f5007
--- /dev/null
+++ b/packages/vscode/test/grammar/dummy/unknown.tmLanguage-dummy.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Dummy Unknown TextMate grammar for use in testing",
+ "scopeName": "source.unknown"
+}
diff --git a/packages/vscode/test/grammar/fixtures/components/component.astro b/packages/vscode/test/grammar/fixtures/components/component.astro
new file mode 100644
index 00000000..dea96841
--- /dev/null
+++ b/packages/vscode/test/grammar/fixtures/components/component.astro
@@ -0,0 +1,3 @@
+