summaryrefslogtreecommitdiff
path: root/queries/rust
diff options
context:
space:
mode:
authorSantos Gallegos <stsewd@protonmail.com>2021-06-10 23:31:31 -0500
committerThomas Vigouroux <tomvig38@gmail.com>2021-06-11 07:54:56 +0200
commit709f3a73b314f86d0c0dd48cc3909f3c2788609f (patch)
tree3e36c8b8036d6010b055691ff352fef935b71802 /queries/rust
parent943edbda008e689f6ce99cc4202c76b836c5524e (diff)
Rust: fix macros highlights
- The derive query was incorrect, it was only matching `#[derive(derive)]` - Macros were being highlighted as keywords - Procedural macros symbols weren't highlighted (`#`, `#!`)
Diffstat (limited to 'queries/rust')
-rw-r--r--queries/rust/highlights.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm
index 527d6a0c..8f7beb23 100644
--- a/queries/rust/highlights.scm
+++ b/queries/rust/highlights.scm
@@ -81,9 +81,9 @@
;; Assume that all `#[derive]` arguments are types
(meta_item
- (identifier) @type
+ (identifier) @_name
arguments: (meta_arguments (meta_item (identifier) @type))
- (#eq? @type "derive"))
+ (#eq? @_name "derive"))
(macro_invocation
macro: (identifier) @function.macro)
@@ -92,6 +92,9 @@
(identifier) @function.macro .))
(metavariable) @function.macro
+(meta_item (identifier) @function.macro)
+(meta_item (scoped_identifier (identifier) @function.macro .))
+
"$" @function.macro
@@ -126,7 +129,10 @@
"."
";"
","
- ] @punctuation.delimiter
+] @punctuation.delimiter
+
+(attribute_item "#" @punctuation.special)
+(inner_attribute_item ["#" "!"] @punctuation.special)
(parameter (identifier) @parameter)
(closure_parameters (_) @parameter)
@@ -166,10 +172,7 @@
"where"
(mutable_specifier)
(super)
-; TODO(vigoux): attribute items should have some kind of injections
-(attribute_item)
-(inner_attribute_item)
- ] @keyword
+] @keyword
"fn" @keyword.function