From a2b9b9bd9d21d6309c33dc746d2b5671bb3b8aa7 Mon Sep 17 00:00:00 2001 From: Sergio Alejandro Vargas Date: Thu, 8 Jul 2021 13:16:34 -0500 Subject: highlights(rust): Reorder macro queries Derive macros have to be defined before attribute macros to highlight them properly. See #570 --- queries/rust/highlights.scm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'queries') diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 6258c2fa8..446ba1c76 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -79,25 +79,29 @@ name: (identifier) @constant) (#match? @constant "^[A-Z]")) -;; Assume that all `#[derive]` arguments are types +;; Macro definitions +"$" @function.macro +(metavariable) @function.macro + +;; Attribute macros +(meta_item (identifier) @function.macro) +(meta_item (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")) +;; Function-like macros (macro_invocation macro: (identifier) @function.macro) (macro_invocation macro: (scoped_identifier (identifier) @function.macro .)) -(metavariable) @function.macro -(meta_item (identifier) @function.macro) -(meta_item (scoped_identifier (identifier) @function.macro .)) -"$" @function.macro - ; Function definitions (function_item (identifier) @function) -- cgit v1.2.3-70-g09d2