Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

go: Highlight predeclared types and built-in functions (#59780)

sollnissced0d857fd5e
diff --git a/crates/grammars/src/go/highlights.scm b/crates/grammars/src/go/highlights.scm
index 670b4f05a96..aaec47bf5e8 100644
--- a/crates/grammars/src/go/highlights.scm
+++ b/crates/grammars/src/go/highlights.scm
@@ -5,6 +5,12 @@
(type_spec
name: (type_identifier) @type.definition)
+((type_identifier) @type.builtin
+ (#any-of? @type.builtin
+ "any" "bool" "byte" "comparable" "complex64" "complex128" "error" "float32" "float64" "int"
+ "int8" "int16" "int32" "int64" "rune" "string" "uint" "uint8" "uint16" "uint32" "uint64"
+ "uintptr"))
+
(field_identifier) @property
(package_identifier) @namespace
@@ -23,6 +29,12 @@
function: (selector_expression
field: (field_identifier) @function.method.call))
+((call_expression
+ function: (identifier) @function.builtin)
+ (#any-of? @function.builtin
+ "append" "cap" "clear" "close" "complex" "copy" "delete" "imag" "len" "make" "max" "min" "new"
+ "panic" "print" "println" "real" "recover"))
+
(function_declaration
name: (identifier) @function)