aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/wxml/highlights.scm
blob: 5bdbd5d509ff6ea68f5c1b77e5943fb244a1a931 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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