on master help sign in
feat: Syntax highlighting for Astro files (#3829)
commitffb41a94f040e251a3269e0d13417b16bef244c0 authorBenjamin Streit <benjaminmstreit@gmail.com> dateTue 13 Sep 2022, 01:53 (4 years ago) parent0d8ffa6
4 files changed+25
book/src/generated/lang-support.md+1 languages.toml+12 runtime/queries/astro/highlights.scm+3 runtime/queries/astro/injections.scm+9
book/src/generated/lang-support.md+1
@@ -1,5 +1,6 @@
11| Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP |
22| --- | --- | --- | --- | --- |
3+| astro | ✓ | | | |
34| awk | ✓ | ✓ | | `awk-language-server` |
45| bash | ✓ | | | `bash-language-server` |
56| beancount | ✓ | | | |
languages.toml+12
@@ -1754,3 +1754,15 @@ language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"]
17541754[[grammar]]
17551755name = "jsonnet"
17561756source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" }
1757+
1758+[[language]]
1759+name = "astro"
1760+scope = "source.astro"
1761+injection-regex = "astro"
1762+file-types = ["astro"]
1763+roots = []
1764+indent = { tab-width = 2, unit = " " }
1765+
1766+[[grammar]]
1767+name = "astro"
1768+source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "5f5c3e73c45967df9aa42f861fad2d77cd4e0900" }
runtime/queries/astro/highlights.scmnew file+3
@@ -0,0 +1,3 @@
1+; inherits: html
2+
3+["---"] @punctuation.delimiter
runtime/queries/astro/injections.scmnew file+9
@@ -0,0 +1,9 @@
1+; inherits: html
2+
3+((frontmatter
4+ (raw_text) @injection.content)
5+ (#set! injection.language "typescript"))
6+
7+((interpolation
8+ (raw_text) @injection.content)
9+ (#set! injection.language "tsx"))