helix-mirror/runtime/queries/bicep/highlights.scm

233 lines
3.0 KiB
Scheme
Raw Normal View History

; Includes
[
"import"
"provider"
"with"
"as"
"from"
] @keyword.control.import
; Namespaces
(module_declaration
(identifier) @namespace)
; Builtins
(primitive_type) @type.builtin
((member_expression
object: (identifier) @type.builtin)
(#eq? @type.builtin "sys"))
; Functions
(call_expression
function: (identifier) @function)
(user_defined_function
name: (identifier) @function)
; Properties
(object_property
(identifier) @function.method
":" @punctuation.delimiter
(_))
(object_property
(compatible_identifier) @function.method
":" @punctuation.delimiter
(_))
(property_identifier) @function.method
; Attributes
(decorator
"@" @attribute)
(decorator
(call_expression
(identifier) @attribute))
(decorator
(call_expression
(member_expression
object: (identifier) @attribute
property: (property_identifier) @attribute)))
; Types
(type_declaration
(identifier) @type)
2022-11-15 05:43:22 +04:00
(type_declaration
(identifier)
"="
(identifier) @type)
(type
(identifier) @type)
(resource_declaration
(identifier) @type)
(resource_expression
(identifier) @type)
; Parameters
(parameter_declaration
(identifier) @variable.parameter
(_))
(call_expression
function: (_)
(arguments
(identifier) @variable.parameter))
(call_expression
function: (_)
(arguments
(member_expression
object: (identifier) @variable.parameter)))
(parameter
.
(identifier) @variable.parameter)
; Variables
(variable_declaration
(identifier) @variable
(_))
(metadata_declaration
(identifier) @variable
(_))
(output_declaration
(identifier) @variable
(_))
(object_property
(_)
":"
(identifier) @variable)
(for_statement
"for"
(for_loop_parameters
(loop_variable) @variable
(loop_enumerator) @variable))
; Conditionals
"if" @keyword.conditional
(ternary_expression
"?" @keyword.control.conditional
":" @keyword.control.conditional)
; Loops
(for_statement
"for" @keyword.control.repeat
"in"
":" @punctuation.delimiter)
; Keywords
2022-11-15 05:43:22 +04:00
[
"module"
"metadata"
"output"
2022-11-15 05:43:22 +04:00
"param"
"resource"
"existing"
"targetScope"
"type"
"var"
"using"
"test"
2022-11-15 05:43:22 +04:00
] @keyword
"func" @keyword.function
2022-11-15 05:43:22 +04:00
"assert" @keyword.control.exception
2022-11-15 05:43:22 +04:00
; Operators
[
"+"
"-"
"*"
"/"
"%"
"||"
"&&"
"|"
"=="
"!="
"=~"
"!~"
">"
">="
"<="
"<"
"??"
"="
"!"
".?"
] @operator
2022-11-15 05:43:22 +04:00
(subscript_expression
"?" @operator)
2022-11-15 05:43:22 +04:00
(nullable_type
"?" @operator)
2022-11-15 05:43:22 +04:00
"in" @keyword.operator
2022-11-15 05:43:22 +04:00
; Literals
(string) @string
2022-11-15 05:43:22 +04:00
(escape_sequence) @constant.character
2022-11-15 05:43:22 +04:00
(number) @constant.number
2022-11-15 05:43:22 +04:00
(boolean) @constant.builtin.boolean
2022-11-15 05:43:22 +04:00
(null) @constant.builtin
2022-11-15 05:43:22 +04:00
; Misc
(compatible_identifier
"?" @punctuation.special)
2022-11-15 05:43:22 +04:00
(nullable_return_type) @punctuation.special
[
"{"
"}"
] @punctuation.bracket
2022-11-15 05:43:22 +04:00
[
"["
"]"
] @punctuation.bracket
2022-11-15 05:43:22 +04:00
[
"("
")"
] @punctuation.bracket
2022-11-15 05:43:22 +04:00
[
"."
":"
"::"
"=>"
] @punctuation.delimiter
2022-11-15 05:43:22 +04:00
; Interpolation
(interpolation
"${" @punctuation.special
"}" @punctuation.special)
(interpolation
(identifier) @variable)
; Comments
[
(comment)
(diagnostic_comment)
] @comment