on master help sign in
syntax: Improve go highlights
commitade1a453efe8bc6d4c5e775ba39da149ef01bb6b authorBlaž Hrastnik <blaz@mxxn.io> dateThu 2 Sep 2021, 15:11 (5 years ago) parent585e3ce
1 file changed+35−4
runtime/queries/go/highlights.scm+35−4
runtime/queries/go/highlights.scm+35−4
@@ -17,9 +17,18 @@
1717
1818; Identifiers
1919
20+((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
21+(const_spec
22+ name: (identifier) @constant)
23+
2024(type_identifier) @type
2125(field_identifier) @property
2226(identifier) @variable
27+(package_identifier) @variable
28+
29+(parameter_declaration (identifier) @variable.parameter)
30+(variadic_parameter_declaration (identifier) @variable.parameter)
31+
2332
2433; Operators
2534
@@ -79,10 +88,8 @@
7988 "go"
8089 "goto"
8190 "if"
82− "import"
8391 "interface"
8492 "map"
85− "package"
8693 "range"
8794 "return"
8895 "select"
@@ -92,6 +99,29 @@
9299 "var"
93100] @keyword
94101
102+[
103+ "import"
104+ "package"
105+] @keyword.control.import
106+
107+; Delimiters
108+
109+[
110+ ":"
111+ "."
112+ ","
113+ ";"
114+] @punctuation.delimiter
115+
116+[
117+ "("
118+ ")"
119+ "["
120+ "]"
121+ "{"
122+ "}"
123+] @punctuation.bracket
124+
95125; Literals
96126
97127[
@@ -111,7 +141,8 @@
111141[
112142 (true)
113143 (false)
114− (nil)
115−] @constant.builtin
144+] @constant.builtin.boolean
145+
146+(nil) @constant.builtin
116147
117148(comment) @comment