aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/heex/highlights.scm
blob: c42a689fc4c620a92f5ea6853883524a21c39620 (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
; https://github.com/connorlay/tree-sitter-heex/blob/592e22292a367312c35e13de7fdb888f029981d6/queries/highlights.scm
; HEEx delimiters
[
  "<!"
  "<!--"
  "<"
  "<%!--"
  "<%#"
  ">"
  "</"
  "--%>"
  "-->"
  "/>"
  ; These could be `@keyword`s but the closing `>` wouldn't be highlighted
  ; as `@keyword`
  "<:"
  "</:"
] @punctuation.bracket

; Non-comment or tag delimiters
[
  "{"
  "}"
  "<%"
  "<%="
  "<%%="
  "%>"
] @keyword

; HEEx operators are highlighted as such
"=" @operator

; HEEx inherits the DOCTYPE tag from HTML
(doctype) @constant

; HEEx comments are highlighted as such
(comment) @comment

; HEEx tags are highlighted as HTML
(tag_name) @tag

; HEEx slots are highlighted as atoms (symbols)
(slot_name) @string.special.symbol

; HEEx attributes are highlighted as HTML attributes
(attribute_name) @attribute
[
  (attribute_value)
  (quoted_attribute_value)
] @string

; HEEx special attributes are keywords
(special_attribute_name) @keyword

; HEEx components are highlighted as Elixir modules and functions
(component_name
  [
    (module) @module
    (function) @function
    "." @punctuation.delimiter
  ])