summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatouš Dzivjak2022-12-05 15:16:25 +0000
committerGitHub2022-12-05 15:16:25 +0000
commit5781aa026417bc6539b80b451da4a99a7057bbe7 (patch)
tree3771bfbcaeccd3ff2d7d60a2f9c19a7d8394344f
parentf712d316e5d210e95f9d297651f1d753646c26d2 (diff)
feat(highlights): go builtin funcs and types (#5010)
Add highlight scopes for golang built-in functions and types. Based on https://pkg.go.dev/builtin.
-rw-r--r--runtime/queries/go/highlights.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm
index 4ff8675b..927bd95b 100644
--- a/runtime/queries/go/highlights.scm
+++ b/runtime/queries/go/highlights.scm
@@ -1,6 +1,10 @@
; 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)$"))
+
+(call_expression
function: (identifier) @function)
(call_expression
@@ -24,6 +28,9 @@
(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)$"))
+
(type_identifier) @type
(field_identifier) @variable.other.member
(identifier) @variable