Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vue tree sitter plugin #787

Merged
merged 3 commits into from
Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
archseer marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -286,6 +286,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"))