Skip to content

Commit

Permalink
Introduce storage_class highlight scope
Browse files Browse the repository at this point in the history
Inspired by VIM's StorageClass hi group
  • Loading branch information
theli-ua committed Jun 9, 2022
1 parent 567e71f commit 28c0ab8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions book/src/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_class` - `static`, `mut`, `const`, `ref`

- `operator` - `||`, `+=`, `>`

Expand Down
4 changes: 2 additions & 2 deletions runtime/queries/c/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(storage_class_specifier) @keyword.storage_class

"goto" @keyword
"register" @keyword
"break" @keyword
"case" @keyword
"const" @keyword
"continue" @keyword
"default" @keyword
"do" @keyword
Expand All @@ -14,7 +15,6 @@
"inline" @keyword
"return" @keyword
"sizeof" @keyword
"static" @keyword
"struct" @keyword
"switch" @keyword
"typedef" @keyword
Expand Down
15 changes: 9 additions & 6 deletions runtime/queries/rust/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,19 @@
"macro_rules!"

"let"
"ref"
"move"

"dyn"
"static"
"const"
"async"
] @keyword

(mutable_specifier) @keyword.mut
[
("&" (identifier))
(mutable_specifier)
"static"
"const"
"ref"
"move"
"dyn"
] @keyword.storage_class

; TODO: variable.mut to highlight mutable identifiers via locals.scm

Expand Down

0 comments on commit 28c0ab8

Please sign in to comment.