helix-mods/runtime/queries/gdscript/highlights.scm

159 lines
2.3 KiB
Scheme
Raw Normal View History

2022-04-15 17:35:23 +02:00
; Identifier naming conventions
2023-03-05 19:41:18 +01:00
(
(identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]+$"))
2022-04-15 17:35:23 +02:00
2022-09-10 15:47:08 +02:00
; class
(class_name_statement (name) @type)
(class_definition (name) @type)
2022-04-15 17:35:23 +02:00
; Function calls
(attribute_call (identifier) @function)
(base_call (identifier) @function)
(call (identifier) @function)
(lambda (name) @function)
2022-04-15 17:35:23 +02:00
; Function definitions
(function_definition
name: (name) @function
parameters: (parameters) @variable.parameter )
2022-04-15 17:35:23 +02:00
(constructor_definition "_init" @function)
(lambda (parameters) @variable.parameter)
2022-04-15 17:35:23 +02:00
2023-03-05 19:41:18 +01:00
2022-04-15 17:35:23 +02:00
;; Literals
(comment) @comment
(string) @string
2023-03-05 19:41:18 +01:00
2022-04-15 17:35:23 +02:00
(type) @type
2023-03-05 19:41:18 +01:00
(expression_statement (array (identifier) @type))
(binary_operator (identifier) @type)
(enum_definition (name) @type.enum)
(enumerator (identifier) @type.enum.variant)
[
(null)
(underscore)
] @type.builtin
2022-04-15 17:35:23 +02:00
2023-03-05 19:41:18 +01:00
(variable_statement (identifier) @variable)
(attribute
(identifier)
(identifier) @variable.other.member)
(attribute
(identifier) @type.builtin
(#match? @type.builtin "^(AABB|Array|Basis|bool|Callable|Color|Dictionary|float|int|NodePath|Object|Packed(Byte|Color|String)Array|PackedFloat(32|64)Array|PackedInt(32|64)Array|PackedVector(2|3)Array|Plane|Projection|Quaternion|Rect2([i]{0,1})|RID|Signal|String|StringName|Transform(2|3)D|Variant|Vector(2|3|4)([i]{0,1}))$"))
[
(string_name)
(node_path)
(get_node)
] @label
(signal_statement (name) @label)
2023-03-05 19:41:18 +01:00
(const_statement (name) @constant)
(integer) @constant.numeric.integer
(float) @constant.numeric.float
(escape_sequence) @constant.character.escape
2022-04-15 17:35:23 +02:00
[
(true)
(false)
2023-03-05 19:41:18 +01:00
] @constant.builtin.boolean
2022-04-15 17:35:23 +02:00
[
"+"
"-"
"*"
"/"
"%"
"=="
"!="
">"
"<"
">="
"<="
"="
"+="
"-="
"*="
"/="
"%="
"&"
"|"
"^"
"~"
"<<"
">>"
":="
":"
2022-04-15 17:35:23 +02:00
] @operator
2023-03-05 19:41:18 +01:00
(annotation (identifier) @keyword.storage.modifier)
2022-04-15 17:35:23 +02:00
[
"if"
"else"
"elif"
"match"
"when"
2023-03-05 19:41:18 +01:00
] @keyword.control.conditional
[
2022-04-15 17:35:23 +02:00
"while"
"for"
2023-03-05 19:41:18 +01:00
] @keyword.control.repeat
[
2022-04-15 17:35:23 +02:00
"return"
2023-03-05 19:41:18 +01:00
"pass"
2022-04-15 17:35:23 +02:00
"break"
"continue"
2023-03-05 19:41:18 +01:00
] @keyword.control.return
[
"func"
] @keyword.control.function
[
"export"
] @keyword.control.import
[
"in"
"is"
"as"
"and"
"or"
"not"
] @keyword.operator
[
"var"
2022-04-15 17:35:23 +02:00
"class"
"class_name"
"enum"
2023-03-05 19:41:18 +01:00
] @keyword.storage.type
[
(remote_keyword)
(static_keyword)
"const"
2022-04-15 17:35:23 +02:00
"signal"
2023-03-05 19:41:18 +01:00
"@"
] @keyword.storage.modifier
[
"setget"
2022-04-15 17:35:23 +02:00
"onready"
"extends"
2023-03-05 19:41:18 +01:00
"set"
"get"
"await"
2022-04-15 17:35:23 +02:00
] @keyword
2023-03-05 19:41:18 +01:00