Skip to content

Commit

Permalink
feat(highlights): go builtin funcs and types (helix-editor#5010)
Browse files Browse the repository at this point in the history
Add highlight scopes for golang built-in functions and types.
Based on https://pkg.go.dev/builtin.
  • Loading branch information
matoous authored and Shekhinah Memmel committed Dec 11, 2022
1 parent 36c15e4 commit a2d56a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions runtime/queries/go/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
; 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)

Expand All @@ -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
Expand Down

0 comments on commit a2d56a4

Please sign in to comment.