Skip to content

Commit eb71d2f

Browse files
authored
zig: Fix highlighting of keywords like orelse, or, and (#18323)
This changes the Zig highlights.scm to tag all keywords with `@keyword` and not with `@keyword.<subtype>`, so the highlighting works properly. Closes #9355 Release Notes: - N/A Demo: ![screenshot-2024-09-25-09 32 20@2x](https://github.com/user-attachments/assets/567b8817-a522-4741-af7f-dcb1a79ddd40)
1 parent fc9db97 commit eb71d2f

File tree

1 file changed

+24
-54
lines changed

1 file changed

+24
-54
lines changed

extensions/zig/languages/zig/highlights.scm

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ field_constant: (IDENTIFIER) @constant
103103
(BlockLabel (IDENTIFIER) @tag)
104104

105105
[
106+
"fn"
106107
"asm"
107108
"defer"
108109
"errdefer"
@@ -112,84 +113,53 @@ field_constant: (IDENTIFIER) @constant
112113
"enum"
113114
"opaque"
114115
"error"
115-
] @keyword
116-
117-
[
116+
"try"
117+
"catch"
118+
"for"
119+
"while"
120+
"break"
121+
"continue"
122+
"const"
123+
"var"
124+
"volatile"
125+
"allowzero"
126+
"noalias"
127+
"addrspace"
128+
"align"
129+
"callconv"
130+
"linksection"
131+
"comptime"
132+
"export"
133+
"extern"
134+
"inline"
135+
"noinline"
136+
"packed"
137+
"pub"
138+
"threadlocal"
118139
"async"
119140
"await"
120141
"suspend"
121142
"nosuspend"
122143
"resume"
123-
] @keyword.coroutine
124-
125-
[
126-
"fn"
127-
] @keyword
128-
129-
[
130144
"and"
131145
"or"
132146
"orelse"
133-
] @operator
134-
135-
[
136147
"return"
137-
] @keyword.return
138-
139-
[
140148
"if"
141149
"else"
142150
"switch"
143-
] @keyword.control
144-
145-
[
146-
"for"
147-
"while"
148-
"break"
149-
"continue"
150151
] @keyword
151152

152153
[
153154
"usingnamespace"
154155
] @constant
155156

156-
[
157-
"try"
158-
"catch"
159-
] @keyword
160-
161157
[
162158
"anytype"
163159
"anyframe"
164160
(BuildinTypeExpr)
165161
] @type
166162

167-
[
168-
"const"
169-
"var"
170-
"volatile"
171-
"allowzero"
172-
"noalias"
173-
] @keyword
174-
175-
[
176-
"addrspace"
177-
"align"
178-
"callconv"
179-
"linksection"
180-
] @keyword.storage
181-
182-
[
183-
"comptime"
184-
"export"
185-
"extern"
186-
"inline"
187-
"noinline"
188-
"packed"
189-
"pub"
190-
"threadlocal"
191-
] @keyword
192-
193163
[
194164
"null"
195165
"unreachable"

0 commit comments

Comments
 (0)