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

193 lines
2.6 KiB
Scheme
Raw Normal View History

2021-04-09 10:42:49 +02:00
; Function calls
(call_expression
function: (identifier) @function.builtin
(match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
2021-04-09 10:42:49 +02:00
(call_expression
function: (identifier) @function)
(call_expression
function: (selector_expression
field: (field_identifier) @function.method))
; Function definitions
(function_declaration
name: (identifier) @function)
(method_declaration
name: (field_identifier) @function.method)
(method_spec
name: (field_identifier) @function.method)
2021-04-09 10:42:49 +02:00
; Identifiers
2021-09-02 08:11:45 +02:00
(const_spec
name: (identifier) @constant)
(parameter_declaration (identifier) @variable.parameter)
(variadic_parameter_declaration (identifier) @variable.parameter)
((type_identifier) @type.builtin
(match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
2021-04-09 10:42:49 +02:00
(type_identifier) @type
(type_spec
name: (type_identifier) @constructor)
(field_identifier) @variable.other.member
2023-09-26 18:05:42 +02:00
(keyed_element (literal_element (identifier) @variable.other.member))
2021-04-09 10:42:49 +02:00
(identifier) @variable
(package_identifier) @namespace
(parameter_declaration (identifier) @variable.parameter)
(variadic_parameter_declaration (identifier) @variable.parameter)
2021-09-02 08:11:45 +02:00
(label_name) @label
(const_spec
name: (identifier) @constant)
2021-04-09 10:42:49 +02:00
; Operators
[
"--"
"-"
"-="
":="
"!"
"!="
"..."
"*"
"*"
"*="
"/"
"/="
"&"
"&&"
"&="
"%"
"%="
"^"
"^="
"+"
"++"
"+="
"<-"
"<"
"<<"
"<<="
"<="
"="
"=="
">"
">="
">>"
">>="
"|"
"|="
"||"
"~"
2021-04-09 10:42:49 +02:00
] @operator
; Keywords
[
"default"
"type"
] @keyword
[
"if"
2021-04-09 10:42:49 +02:00
"else"
"switch"
"select"
"case"
] @keyword.control.conditional
[
2021-04-09 10:42:49 +02:00
"for"
"range"
] @keyword.control.repeat
2021-04-09 10:42:49 +02:00
2021-09-02 08:11:45 +02:00
[
"import"
"package"
] @keyword.control.import
[
"return"
"continue"
"break"
"fallthrough"
] @keyword.control.return
[
"func"
] @keyword.function
[
"var"
"chan"
"interface"
"map"
"struct"
] @keyword.storage.type
[
"const"
] @keyword.storage.modifier
[
"defer"
"goto"
"go"
] @function.macro
2021-09-02 08:11:45 +02:00
; Delimiters
[
":"
"."
","
";"
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
2021-04-09 10:42:49 +02:00
; Literals
[
(interpreted_string_literal)
(raw_string_literal)
(rune_literal)
] @string
(escape_sequence) @constant.character.escape
2021-04-09 10:42:49 +02:00
[
(int_literal)
(float_literal)
(imaginary_literal)
] @constant.numeric.integer
2021-04-09 10:42:49 +02:00
[
(true)
(false)
2021-09-02 08:11:45 +02:00
] @constant.builtin.boolean
[
(nil)
(iota)
] @constant.builtin
2021-04-09 10:42:49 +02:00
(comment) @comment