feat: add support for svelte

This commit is contained in:
elianiva 2021-02-05 13:45:26 +07:00 committed by Stephan Seitz
parent 2d82a7fe07
commit a73e200abf
5 changed files with 79 additions and 0 deletions

View file

@ -446,6 +446,15 @@ list.devicetree = {
maintainers = { "@jedrzejboczar" },
}
list.svelte = {
install_info = {
url = "https://github.com/Himujjal/tree-sitter-svelte",
files = { "src/parser.c", "src/scanner.cc" },
branch = "master",
},
maintainers = { "@elianiva" },
}
local M = {
list = list
}

9
queries/svelte/folds.scm Normal file
View file

@ -0,0 +1,9 @@
[
(style_element)
(script_element)
(element)
(if_statement)
(else_statement)
(each_statement)
(await_statement)
] @fold

View file

@ -0,0 +1,29 @@
(tag_name) @tag
(attribute_name) @property
(attribute_value) @string
(quoted_attribute_value) @string
(comment) @comment
[
(special_block_keyword)
(then)
(as)
] @keyword
[
"{"
"}"
] @punctuation.bracket
"=" @operator
[
"<"
">"
"</"
"/>"
"#"
":"
"/"
"@"
] @tag.delimiter

View file

@ -0,0 +1,16 @@
[
(element)
(if_statement)
(each_statement)
(await_statement)
] @indent
[
(end_tag)
(else_statement)
(if_end_expr)
(each_end_expr)
(await_end_expr)
">"
"/>"
] @branch

View file

@ -0,0 +1,16 @@
((style_element
(raw_text) @css))
((script_element
(raw_text) @javascript))
((raw_text_expr) @javascript)
(
(script_element
(start_tag
(attribute
(quoted_attribute_value (attribute_value) @_lang)))
(raw_text) @typescript)
(#match? @_lang "(ts|typescript)")
)