Skip to content

Commit 5781aa0

Browse files
authored
feat(highlights): go builtin funcs and types (helix-editor#5010)
Add highlight scopes for golang built-in functions and types. Based on https://pkg.go.dev/builtin.
1 parent f712d31 commit 5781aa0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

runtime/queries/go/highlights.scm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
; Function calls
22

3+
(call_expression
4+
function: (identifier) @function.builtin
5+
(match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
6+
37
(call_expression
48
function: (identifier) @function)
59

@@ -24,6 +28,9 @@
2428
(parameter_declaration (identifier) @variable.parameter)
2529
(variadic_parameter_declaration (identifier) @variable.parameter)
2630

31+
((type_identifier) @type.builtin
32+
(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)$"))
33+
2734
(type_identifier) @type
2835
(field_identifier) @variable.other.member
2936
(identifier) @variable

0 commit comments

Comments
 (0)