diff options
| author | mvink <mike1994vink@gmail.com> | 2022-11-16 12:43:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-16 12:43:46 +0100 |
| commit | 5e255e41669f1f7c985bc0f44a5f551b8caebaf3 (patch) | |
| tree | 6f01b4bc2ad83a6f6455b47c71c9b797a3dee3ea /queries/rust/highlights.scm | |
| parent | fdaab4dff7768fd63430fb29f80cb7ebea6fe887 (diff) | |
| parent | dc27512e0019dcf4b6fbf0e0d5f285b4c9858308 (diff) | |
Diffstat (limited to 'queries/rust/highlights.scm')
| -rw-r--r-- | queries/rust/highlights.scm | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index c08912be..c7cd1174 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -25,7 +25,6 @@ (self) @variable.builtin -(lifetime ["'" (identifier)] @label) (loop_label ["'" (identifier)] @label) @@ -72,6 +71,9 @@ (scoped_type_identifier path: (identifier) @namespace) (scoped_type_identifier + path: (identifier) @type + (#lua-match? @type "^[A-Z]")) +(scoped_type_identifier (scoped_identifier name: (identifier) @namespace)) ((scoped_identifier @@ -121,14 +123,14 @@ (macro_definition "macro_rules!" @function.macro) ;; Attribute macros -(attribute_item (meta_item (identifier) @function.macro)) -(meta_item (scoped_identifier (identifier) @function.macro .)) +(attribute_item (attribute (identifier) @function.macro)) +(attribute (scoped_identifier (identifier) @function.macro .)) ;; Derive macros (assume all arguments are types) -(meta_item - (identifier) @_name - arguments: (meta_arguments (meta_item (identifier) @type)) - (#eq? @_name "derive")) +; (attribute +; (identifier) @_name +; arguments: (attribute (attribute (identifier) @type)) +; (#eq? @_name "derive")) ;; Function-like macros (macro_invocation @@ -169,7 +171,6 @@ [ "async" "await" - "const" "default" "dyn" "enum" @@ -179,17 +180,26 @@ "match" "move" "pub" - "ref" - "static" "struct" "trait" "type" "union" "unsafe" "where" - (mutable_specifier) ] @keyword +[ + "ref" + (mutable_specifier) +] @type.qualifier + +[ + "const" + "static" +] @storageclass + +(lifetime ["'" (identifier)] @storageclass.lifetime) + "fn" @keyword.function [ "return" @@ -201,7 +211,8 @@ (use_list (self) @keyword) (scoped_use_list (self) @keyword) -(scoped_identifier (self) @keyword) +(scoped_identifier [(crate) (super) (self)] @keyword) +(visibility_modifier [(crate) (super) (self)] @keyword) [ "else" @@ -216,8 +227,7 @@ "while" ] @repeat -(impl_item - "for" @keyword) +"for" @keyword (for_expression "for" @repeat) @@ -266,6 +276,8 @@ (closure_parameters "|" @punctuation.bracket) (type_arguments ["<" ">"] @punctuation.bracket) (type_parameters ["<" ">"] @punctuation.bracket) +(bracketed_type ["<" ">"] @punctuation.bracket) +(for_lifetimes ["<" ">"] @punctuation.bracket) ["," "." ":" "::" ";"] @punctuation.delimiter @@ -273,3 +285,8 @@ (inner_attribute_item ["!" "#"] @punctuation.special) (macro_invocation "!" @function.macro) (empty_type "!" @type.builtin) + +(macro_invocation macro: (identifier) @_ident @exception "!" @exception + (#eq? @_ident "panic")) +(macro_invocation macro: (identifier) @_ident @exception "!" @exception + (#contains? @_ident "assert")) |
