diff options
author | Erasin Wang | 2023-03-08 00:33:13 +0000 |
---|---|---|
committer | GitHub | 2023-03-08 00:33:13 +0000 |
commit | 0e5a4e55a497c58f68859edb48fd85854403b866 (patch) | |
tree | 19f76a975e37a5633d74c385a0464d8c8b3170c4 /runtime | |
parent | 622f90a157cd3cdac71437851d4a2a2bd38e0a79 (diff) |
Update highlights for golang (#6204)
- update tree-sitter-go
- refine keywords
- set package as namespace
- add label
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queries/go/highlights.scm | 75 |
1 files changed, 54 insertions, 21 deletions
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index 927bd95b..b2d81e45 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -19,6 +19,9 @@ (method_declaration name: (field_identifier) @function.method) +(method_spec + name: (field_identifier) @function.method) + ; Identifiers ((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$")) @@ -32,10 +35,19 @@ (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 (identifier) @variable -(package_identifier) @variable +(package_identifier) @namespace + +(parameter_declaration (identifier) @variable.parameter) +(variadic_parameter_declaration (identifier) @variable.parameter) +(label_name) @label + +(const_spec + name: (identifier) @constant) ; Operators @@ -82,36 +94,57 @@ ; Keywords [ - "break" - "case" - "chan" - "const" - "continue" "default" - "defer" + "type" +] @keyword + +[ + "if" "else" - "fallthrough" + "switch" + "select" + "case" +] @keyword.control.conditional + +[ "for" - "func" - "go" - "goto" - "if" - "interface" - "map" "range" - "return" - "select" - "struct" - "switch" - "type" - "var" -] @keyword +] @keyword.control.repeat [ "import" "package" ] @keyword.control.import +[ + "return" + "continue" + "break" + "fallthrough" +] @keyword.control.return + +[ + "func" +] @keyword.function + +[ + "var" + "chan" + "interface" + "map" + "struct" +] @keyword.storage.type + +[ + "const" +] @keyword.storage.modifier + +[ + "defer" + "goto" + "go" +] @function.macro + ; Delimiters [ |