on master help sign in
Update highlights for golang (#6204)
0e5a4e5Erasin Wang
languages.toml+1−1
@@ -324,7 +324,7 @@ args = { mode = "local", processId = "{0}" }
324
324
325[[grammar]]
325[[grammar]]
326name = "go"
326name = "go"
327−source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "05900faa3cdb5d2d8c8bd5e77ee698487e0a8611" }
327+source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "64457ea6b73ef5422ed1687178d4545c3e91334a" }
328
328
329[[language]]
329[[language]]
330name = "gomod"
330name = "gomod"
runtime/queries/go/highlights.scm+54−21
@@ -19,6 +19,9 @@
19(method_declaration
19(method_declaration
20 name: (field_identifier) @function.method)
20 name: (field_identifier) @function.method)
21
21
22+(method_spec
23+ name: (field_identifier) @function.method)
24+
22; Identifiers
25; Identifiers
23
26
24((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
27((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
@@ -32,10 +35,19 @@
32 (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)$"))
35 (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)$"))
33
36
34(type_identifier) @type
37(type_identifier) @type
38+(type_spec
39+ name: (type_identifier) @constructor)
35(field_identifier) @variable.other.member
40(field_identifier) @variable.other.member
36(identifier) @variable
41(identifier) @variable
37−(package_identifier) @variable
42+(package_identifier) @namespace
43+
44+(parameter_declaration (identifier) @variable.parameter)
45+(variadic_parameter_declaration (identifier) @variable.parameter)
38
46
47+(label_name) @label
48+
49+(const_spec
50+ name: (identifier) @constant)
39
51
40; Operators
52; Operators
41
53
@@ -82,36 +94,57 @@
82; Keywords
94; Keywords
83
95
84[
96[
85− "break"
86− "case"
87− "chan"
88− "const"
89− "continue"
90 "default"
97 "default"
91− "defer"
98+ "type"
99+] @keyword
100+
101+[
102+ "if"
92 "else"
103 "else"
93− "fallthrough"
104+ "switch"
105+ "select"
106+ "case"
107+] @keyword.control.conditional
108+
109+[
94 "for"
110 "for"
95− "func"
96− "go"
97− "goto"
98− "if"
99− "interface"
100− "map"
101 "range"
111 "range"
102− "return"
103− "select"
104− "struct"
105− "switch"
106− "type"
107− "var"
108−] @keyword
112+] @keyword.control.repeat
109
113
110[
114[
111 "import"
115 "import"
112 "package"
116 "package"
113] @keyword.control.import
117] @keyword.control.import
114
118
119+[
120+ "return"
121+ "continue"
122+ "break"
123+ "fallthrough"
124+] @keyword.control.return
125+
126+[
127+ "func"
128+] @keyword.function
129+
130+[
131+ "var"
132+ "chan"
133+ "interface"
134+ "map"
135+ "struct"
136+] @keyword.storage.type
137+
138+[
139+ "const"
140+] @keyword.storage.modifier
141+
142+[
143+ "defer"
144+ "goto"
145+ "go"
146+] @function.macro
147+
115; Delimiters
148; Delimiters
116
149
117[
150[