mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
highlights(rust): Reorder macro queries
Derive macros have to be defined before attribute macros to highlight them properly. See #570
This commit is contained in:
parent
6d18b93ce7
commit
a2b9b9bd9d
1 changed files with 10 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue