nvim-treesitter/queries/hcl/highlights.scm

103 lines
1.8 KiB
Scheme
Raw Normal View History

2021-06-28 19:11:33 +02:00
; highlights.scm
[
"!"
"\*"
"/"
"%"
"\+"
"-"
">"
">="
"<"
"<="
"=="
"!="
"&&"
"||"
] @operator
[
"{"
"}"
"["
"]"
"("
")"
2021-06-28 20:05:27 +02:00
] @punctuation.bracket
2021-06-28 19:11:33 +02:00
[
"."
2021-06-28 20:05:27 +02:00
".*"
2021-06-28 19:11:33 +02:00
","
2021-06-28 20:05:27 +02:00
"[*]"
] @punctuation.delimiter
2021-06-28 19:11:33 +02:00
[
(ellipsis)
"\?"
"=>"
2021-06-28 20:05:27 +02:00
] @punctuation.special
2021-06-28 19:11:33 +02:00
2021-06-30 23:39:24 +02:00
[
":"
"="
] @none
2021-06-28 19:11:33 +02:00
[
"for"
2021-09-20 21:58:20 +02:00
"endfor"
2021-06-28 19:11:33 +02:00
"in"
] @repeat
[
"if"
2021-09-20 21:58:20 +02:00
"else"
"endif"
2021-06-28 19:11:33 +02:00
] @conditional
[
(quoted_template_start) ; "
(quoted_template_end); "
(template_literal) ; non-interpolation/directive content
2021-06-28 19:11:33 +02:00
] @string
2021-06-30 23:39:24 +02:00
[
(heredoc_identifier) ; <<END
(heredoc_start) ; END
] @punctuation.delimiter
2021-06-30 23:39:24 +02:00
2021-09-20 21:58:20 +02:00
[
(template_interpolation_start) ; ${
(template_interpolation_end) ; }
(template_directive_start) ; %{
(template_directive_end) ; }
(strip_marker) ; ~
] @punctuation.special
2021-06-28 20:05:27 +02:00
2021-06-28 19:11:33 +02:00
(numeric_lit) @number
(bool_lit) @boolean
(null_lit) @constant
(comment) @comment
2021-07-01 08:43:42 +02:00
(identifier) @variable
2021-06-28 19:11:33 +02:00
2021-06-30 23:39:24 +02:00
(block (identifier) @type)
2021-06-28 19:11:33 +02:00
(function_call (identifier) @function)
2021-07-01 08:43:42 +02:00
(attribute (identifier) @field)
2021-06-28 19:11:33 +02:00
; { key: val }
;
; highlight identifier keys as though they were block attributes
(object_elem key: (expression (variable_expr (identifier) @field)))
((identifier) @keyword (#any-of? @keyword "module" "root" "cwd" "resource" "variable" "data" "locals" "terraform" "provider" "output"))
2021-07-04 15:32:26 -06:00
((identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))
(variable_expr (identifier) @variable.builtin (#any-of? @variable.builtin "var" "local" "path"))
(get_attr (identifier) @variable.builtin (#any-of? @variable.builtin "root" "cwd" "module"))
2021-07-04 15:32:26 -06:00
(object_elem val: (expression
(variable_expr
(identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))))
2021-06-28 19:11:33 +02:00
(ERROR) @error