Add Vue tree sitter grammar (#787)
* ✨ Add vue tree sitter support
* Update .gitmodules
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
commita7f49fa56fecd7f44efca7e6074e5cd9e5d91c92
authorThomas Wehmöller <connect.mordrag@gmx.de>
dateSun 10 Oct 2021, 15:09 (5 years ago)
parent4260b31
.gitmodules+4
@@ -122,3 +122,7 @@
122122 path = helix-syntax/languages/tree-sitter-svelte
123123 url = https://github.com/Himujjal/tree-sitter-svelte
124124 shallow = true
125+[submodule "helix-syntax/languages/tree-sitter-vue"]
126+ path = helix-syntax/languages/tree-sitter-vue
127+ url = https://github.com/ikatyang/tree-sitter-vue
128+ shallow = true
helix-syntax/languages/tree-sitter-vuenew file+1
Submodule changed.
languages.toml+9
@@ -278,6 +278,15 @@ roots = []
278278indent = { tab-width = 2, unit = " " }
279279language-server = { command = "svelteserver", args = ["--stdio"] }
280280
281+
282+[[language]]
283+name = "vue"
284+scope = "source.vue"
285+injection-regex = "vue"
286+file-types = ["vue"]
287+roots = []
288+indent = { tab-width = 2, unit = " " }
289+
281290[[language]]
282291name = "yaml"
283292scope = "source.yaml"
runtime/queries/vue/highlights.scmnew file+21
@@ -0,0 +1,21 @@
1+(tag_name) @tag
2+(end_tag) @tag
3+
4+(directive_name) @keyword
5+(directive_argument) @constant
6+
7+(attribute
8+ (attribute_name) @attribute
9+ (quoted_attribute_value
10+ (attribute_value) @string)
11+)
12+
13+(comment) @comment
14+
15+[
16+ "<"
17+ ">"
18+ "</"
19+ "{{"
20+ "}}"
21+] @punctuation.bracket
runtime/queries/vue/injections.scmnew file+17
@@ -0,0 +1,17 @@
1+(directive_attribute
2+ (directive_name) @keyword
3+ (quoted_attribute_value
4+ (attribute_value) @injection.content)
5+ (#set! injection.language "javascript"))
6+
7+((interpolation
8+ (raw_text) @injection.content)
9+ (#set! injection.language "javascript"))
10+
11+((script_element
12+ (raw_text) @injection.content)
13+ (#set! injection.language "javascript"))
14+
15+((style_element
16+ (raw_text) @injection.content)
17+ (#set! injection.language "css"))