Introduce storage_class highlight scope (#2731)

This commit is contained in:
Anton Romanov 2022-06-14 10:35:36 -07:00 committed by GitHub
parent cdeab337cd
commit 7983c71752
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 8 deletions

View file

@ -151,6 +151,7 @@ We use a similar set of scopes as
- `operator` - `or`, `in`
- `directive` - Preprocessor directives (`#if` in C)
- `function` - `fn`, `func`
- `storage` - Keywords that affect the storage of a variable, function or data structure `static`, `mut`, `const`, `ref`
- `operator` - `||`, `+=`, `>`

View file

@ -1,8 +1,9 @@
(storage_class_specifier) @keyword.storage
"goto" @keyword
"register" @keyword
"break" @keyword
"case" @keyword
"const" @keyword
"continue" @keyword
"default" @keyword
"do" @keyword
@ -14,7 +15,6 @@
"inline" @keyword
"return" @keyword
"sizeof" @keyword
"static" @keyword
"struct" @keyword
"switch" @keyword
"typedef" @keyword

View file

@ -156,16 +156,22 @@
"macro_rules!"
"let"
"ref"
"move"
"dyn"
"static"
"const"
"async"
] @keyword
(mutable_specifier) @keyword.mut
(mutable_specifier) @keyword.storage.modifier.mut
(reference_type "&" @keyword.storage.modifier.ref)
(self_parameter "&" @keyword.storage.modifier.ref)
[
"static"
"const"
"ref"
"move"
"dyn"
] @keyword.storage.modifier
; TODO: variable.mut to highlight mutable identifiers via locals.scm