on master help sign in
Introduce storage_class highlight scope (#2731)
7983c71Anton Romanov
book/src/themes.md+1
@@ -151,6 +151,7 @@ We use a similar set of scopes as
151 - `operator` - `or`, `in`
151 - `operator` - `or`, `in`
152 - `directive` - Preprocessor directives (`#if` in C)
152 - `directive` - Preprocessor directives (`#if` in C)
153 - `function` - `fn`, `func`
153 - `function` - `fn`, `func`
154+ - `storage` - Keywords that affect the storage of a variable, function or data structure `static`, `mut`, `const`, `ref`
154
155
155- `operator` - `||`, `+=`, `>`
156- `operator` - `||`, `+=`, `>`
156
157
runtime/queries/c/highlights.scm+2−2
@@ -1,8 +1,9 @@
1+(storage_class_specifier) @keyword.storage
2+
1"goto" @keyword
3"goto" @keyword
2"register" @keyword
4"register" @keyword
3"break" @keyword
5"break" @keyword
4"case" @keyword
6"case" @keyword
5−"const" @keyword
6"continue" @keyword
7"continue" @keyword
7"default" @keyword
8"default" @keyword
8"do" @keyword
9"do" @keyword
@@ -14,7 +15,6 @@
14"inline" @keyword
15"inline" @keyword
15"return" @keyword
16"return" @keyword
16"sizeof" @keyword
17"sizeof" @keyword
17−"static" @keyword
18"struct" @keyword
18"struct" @keyword
19"switch" @keyword
19"switch" @keyword
20"typedef" @keyword
20"typedef" @keyword
runtime/queries/rust/highlights.scm+12−6
@@ -156,16 +156,22 @@
156 "macro_rules!"
156 "macro_rules!"
157
157
158 "let"
158 "let"
159− "ref"
160− "move"
161
159
162− "dyn"
163− "static"
164− "const"
165 "async"
160 "async"
166] @keyword
161] @keyword
167
162
168−(mutable_specifier) @keyword.mut
163+(mutable_specifier) @keyword.storage.modifier.mut
164+
165+(reference_type "&" @keyword.storage.modifier.ref)
166+(self_parameter "&" @keyword.storage.modifier.ref)
167+
168+[
169+ "static"
170+ "const"
171+ "ref"
172+ "move"
173+ "dyn"
174+] @keyword.storage.modifier
169
175
170; TODO: variable.mut to highlight mutable identifiers via locals.scm
176; TODO: variable.mut to highlight mutable identifiers via locals.scm
171
177