nvim-treesitter/queries/hcl/highlights.scm

98 lines
1.6 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"
"in"
] @repeat
[
"if"
] @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
( template_interpolation
[
(template_interpolation_start) ; ${
(template_interpolation_end) ; }
2021-07-04 15:32:26 -06:00
] @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)))
2021-07-04 15:32:26 -06:00
(variable_expr (identifier) @variable.builtin (#any-of? @variable.builtin "var" "local"))
((identifier) @keyword (#any-of? @keyword "module" "resource" "variable" "data" "locals" "terraform" "provider" "output"))
((identifier) @type.builtin (#any-of? @type.builtin "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))
(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