From 709f3a73b314f86d0c0dd48cc3909f3c2788609f Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Thu, 10 Jun 2021 23:31:31 -0500 Subject: 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 (`#`, `#!`) --- queries/rust/highlights.scm | 17 ++++++++++------- 1 file 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 -- cgit v1.2.3