highlights.scm

  1; https://github.com/nvim-treesitter/nvim-treesitter/blob/cb79d2446196d25607eb1d982c96939abdf67b8e/queries/hcl/highlights.scm
  2; highlights.scm
  3[
  4  "!"
  5  "\*"
  6  "/"
  7  "%"
  8  "\+"
  9  "-"
 10  ">"
 11  ">="
 12  "<"
 13  "<="
 14  "=="
 15  "!="
 16  "&&"
 17  "||"
 18] @operator
 19
 20[
 21  "{"
 22  "}"
 23  "["
 24  "]"
 25  "("
 26  ")"
 27] @punctuation.bracket
 28
 29[
 30  "."
 31  ".*"
 32  ","
 33  "[*]"
 34] @punctuation.delimiter
 35
 36[
 37  (ellipsis)
 38  "\?"
 39  "=>"
 40] @punctuation.special
 41
 42[
 43  ":"
 44  "="
 45] @punctuation
 46
 47[
 48  "for"
 49  "endfor"
 50  "in"
 51  "if"
 52  "else"
 53  "endif"
 54] @keyword
 55
 56[
 57  (quoted_template_start) ; "
 58  (quoted_template_end) ; "
 59  (template_literal) ; non-interpolation/directive content
 60] @string
 61
 62[
 63  (heredoc_identifier) ; END
 64  (heredoc_start) ; << or <<-
 65] @punctuation.delimiter
 66
 67[
 68  (template_interpolation_start) ; ${
 69  (template_interpolation_end) ; }
 70  (template_directive_start) ; %{
 71  (template_directive_end) ; }
 72  (strip_marker) ; ~
 73] @punctuation.special
 74
 75(numeric_lit) @number
 76
 77(bool_lit) @boolean
 78
 79(null_lit) @constant
 80
 81(comment) @comment
 82
 83(identifier) @variable
 84
 85(body
 86  (block
 87    (identifier) @keyword))
 88
 89(body
 90  (block
 91    (body
 92      (block
 93        (identifier) @type))))
 94
 95(function_call
 96  (identifier) @function)
 97
 98(attribute
 99  (identifier) @variable)
100
101; { key: val }
102;
103; highlight identifier keys as though they were block attributes
104(object_elem
105  key:
106    (expression
107      (variable_expr
108        (identifier) @variable)))
109
110; var.foo, data.bar
111;
112; first element in get_attr is a variable.builtin or a reference to a variable.builtin
113(expression
114  (variable_expr
115    (identifier) @variable)
116  (get_attr
117    (identifier) @variable))