From f73e9a8d15fd5a87d472a49808baf42ba403f9bf Mon Sep 17 00:00:00 2001 From: Joey Hain Date: Sun, 5 Nov 2023 17:54:25 -0800 Subject: highlights: add type.parameter scope to several more languages (#8718) * typescript * go * haskell * ocaml * kotlin (+ bugfix)--- runtime/queries/go/highlights.scm | 16 ++++++++++++---- runtime/queries/go/locals.scm | 12 ++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'runtime/queries/go') diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index b45a11be..fba2df99 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -11,6 +11,18 @@ function: (selector_expression field: (field_identifier) @function.method)) + +; Types + +(type_parameter_list + (parameter_declaration + name: (identifier) @type.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 + ; Function definitions (function_declaration @@ -30,10 +42,6 @@ (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 (type_spec name: (type_identifier) @constructor) (field_identifier) @variable.other.member diff --git a/runtime/queries/go/locals.scm b/runtime/queries/go/locals.scm index aae56257..14a6f3e4 100644 --- a/runtime/queries/go/locals.scm +++ b/runtime/queries/go/locals.scm @@ -1,9 +1,17 @@ ; Scopes -(block) @local.scope +[ + (function_declaration) + (type_declaration) + (block) +] @local.scope ; Definitions +(type_parameter_list + (parameter_declaration + name: (identifier) @local.definition)) + (parameter_declaration (identifier) @local.definition) (variadic_parameter_declaration (identifier) @local.definition) @@ -27,4 +35,4 @@ (identifier) @local.reference (field_identifier) @local.reference - +(type_identifier) @local.reference -- cgit v1.2.3-70-g09d2