mirror of
https://github.com/chenasraf/nvim-treesitter.git
synced 2026-05-17 17:38:02 +00:00
feat(wxml): add parser and queries
This commit is contained in:
1
SUPPORTED_LANGUAGES.md
generated
1
SUPPORTED_LANGUAGES.md
generated
@@ -326,6 +326,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka
|
||||
[wgsl_bevy](https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy) | unstable | `HFI ` | | @theHamsta
|
||||
[wing](https://github.com/winglang/tree-sitter-wing) | unstable | `HF JL` | | @gshpychka, @MarkMcCulloh
|
||||
[wit](https://github.com/bytecodealliance/tree-sitter-wit) | unstable | `HF J ` | | @mkatychev
|
||||
[wxml](https://github.com/BlockLune/tree-sitter-wxml) | unstable | `HFIJ ` | | @BlockLune
|
||||
[xcompose](https://github.com/tree-sitter-grammars/tree-sitter-xcompose) | unstable | `H JL` | | @ObserverOfTime
|
||||
[xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) | unstable | `HFIJL` | | @ObserverOfTime
|
||||
[xresources](https://github.com/ValdezFOmar/tree-sitter-xresources) | unstable | `HF JL` | | @ValdezFOmar
|
||||
|
||||
@@ -2587,6 +2587,14 @@ return {
|
||||
maintainers = { '@mkatychev' },
|
||||
tier = 2,
|
||||
},
|
||||
wxml = {
|
||||
install_info = {
|
||||
revision = '7b821c748dc410332f59496c0dea2632168c4e5a',
|
||||
url = 'https://github.com/BlockLune/tree-sitter-wxml',
|
||||
},
|
||||
maintainers = { '@BlockLune' },
|
||||
tier = 2,
|
||||
},
|
||||
xcompose = {
|
||||
install_info = {
|
||||
revision = 'a51d6366f041dbefec4da39a7eb3168a9b1cbc0e',
|
||||
|
||||
7
runtime/queries/wxml/folds.scm
Normal file
7
runtime/queries/wxml/folds.scm
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
(element)
|
||||
(block_element)
|
||||
(slot_element)
|
||||
(template_element)
|
||||
(wxs_element)
|
||||
] @fold
|
||||
66
runtime/queries/wxml/highlights.scm
Normal file
66
runtime/queries/wxml/highlights.scm
Normal file
@@ -0,0 +1,66 @@
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
|
||||
; Text
|
||||
(text) @spell
|
||||
|
||||
; Tag names
|
||||
(tag_name) @tag
|
||||
|
||||
((tag_name) @tag.builtin
|
||||
(#any-of? @tag.builtin "wxs" "template" "import" "include" "slot" "block"))
|
||||
|
||||
; Attributes
|
||||
(attribute_name) @tag.attribute
|
||||
|
||||
(attribute_value) @string
|
||||
|
||||
(quoted_attribute_value) @string
|
||||
|
||||
; WeChat specific attributes
|
||||
((attribute_name) @keyword.directive
|
||||
(#lua-match? @keyword.directive "^wx:"))
|
||||
|
||||
((attribute_name) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "wx:if" "wx:elif" "wx:else"))
|
||||
|
||||
((attribute_name) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "wx:for" "wx:for-index" "wx:for-item"))
|
||||
|
||||
((attribute_name) @keyword
|
||||
(#lua-match? @keyword "^bind"))
|
||||
|
||||
((attribute_name) @keyword
|
||||
(#lua-match? @keyword "^catch"))
|
||||
|
||||
((attribute_name) @keyword
|
||||
(#lua-match? @keyword "^mut%-bind"))
|
||||
|
||||
((attribute_name) @keyword
|
||||
(#lua-match? @keyword "^model:"))
|
||||
|
||||
((attribute_name) @keyword
|
||||
(#lua-match? @keyword "^data-"))
|
||||
|
||||
((attribute
|
||||
(attribute_name) @_attr
|
||||
(quoted_attribute_value) @string.special.url)
|
||||
(#any-of? @_attr "href" "src")
|
||||
(#offset! @string.special.url 0 1 0 -1))
|
||||
|
||||
; Entity references
|
||||
(entity) @character.special
|
||||
|
||||
; Interpolation delimiters
|
||||
(interpolation_start) @punctuation.special
|
||||
|
||||
(interpolation_end) @punctuation.special
|
||||
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
"</"
|
||||
"/>"
|
||||
] @tag.delimiter
|
||||
|
||||
"=" @operator
|
||||
32
runtime/queries/wxml/indents.scm
Normal file
32
runtime/queries/wxml/indents.scm
Normal file
@@ -0,0 +1,32 @@
|
||||
; inherits: html_tags
|
||||
|
||||
(block_element) @indent.begin
|
||||
|
||||
(template_element) @indent.begin
|
||||
|
||||
(wxs_element) @indent.begin
|
||||
|
||||
(block_element
|
||||
(block_end_tag
|
||||
">" @indent.end))
|
||||
|
||||
(template_element
|
||||
(template_end_tag
|
||||
">" @indent.end))
|
||||
|
||||
(wxs_element
|
||||
(wxs_end_tag
|
||||
">" @indent.end))
|
||||
|
||||
(block_element
|
||||
(block_end_tag) @indent.branch)
|
||||
|
||||
(template_element
|
||||
(template_end_tag) @indent.branch)
|
||||
|
||||
(wxs_element
|
||||
(wxs_end_tag) @indent.branch)
|
||||
|
||||
(import_statement) @indent.ignore
|
||||
|
||||
(include_statement) @indent.ignore
|
||||
10
runtime/queries/wxml/injections.scm
Normal file
10
runtime/queries/wxml/injections.scm
Normal file
@@ -0,0 +1,10 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((raw_text) @injection.content
|
||||
(#set! injection.language "javascript")
|
||||
(#set! injection.include-children))
|
||||
|
||||
((expression) @injection.content
|
||||
(#set! injection.language "javascript")
|
||||
(#set! injection.include-children))
|
||||
Reference in New Issue
Block a user