Skip to content

Commit

Permalink
Add Vue tree sitter grammar (#787)
Browse files Browse the repository at this point in the history
* ✨ Add vue tree sitter support

* Update .gitmodules

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
  • Loading branch information
MordragT and archseer authored Oct 10, 2021
1 parent 4260b31 commit a7f49fa
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,7 @@
path = helix-syntax/languages/tree-sitter-svelte
url = https://github.com/Himujjal/tree-sitter-svelte
shallow = true
[submodule "helix-syntax/languages/tree-sitter-vue"]
path = helix-syntax/languages/tree-sitter-vue
url = https://github.com/ikatyang/tree-sitter-vue
shallow = true
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-vue
Submodule tree-sitter-vue added at 91fe27
9 changes: 9 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@ roots = []
indent = { tab-width = 2, unit = " " }
language-server = { command = "svelteserver", args = ["--stdio"] }


[[language]]
name = "vue"
scope = "source.vue"
injection-regex = "vue"
file-types = ["vue"]
roots = []
indent = { tab-width = 2, unit = " " }

[[language]]
name = "yaml"
scope = "source.yaml"
Expand Down
21 changes: 21 additions & 0 deletions runtime/queries/vue/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(tag_name) @tag
(end_tag) @tag

(directive_name) @keyword
(directive_argument) @constant

(attribute
(attribute_name) @attribute
(quoted_attribute_value
(attribute_value) @string)
)

(comment) @comment

[
"<"
">"
"</"
"{{"
"}}"
] @punctuation.bracket
17 changes: 17 additions & 0 deletions runtime/queries/vue/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(directive_attribute
(directive_name) @keyword
(quoted_attribute_value
(attribute_value) @injection.content)
(#set! injection.language "javascript"))

((interpolation
(raw_text) @injection.content)
(#set! injection.language "javascript"))

((script_element
(raw_text) @injection.content)
(#set! injection.language "javascript"))

((style_element
(raw_text) @injection.content)
(#set! injection.language "css"))

0 comments on commit a7f49fa

Please sign in to comment.