mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 10:20:11 -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)
|
name: (identifier) @constant)
|
||||||
(#match? @constant "^[A-Z]"))
|
(#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
|
(meta_item
|
||||||
(identifier) @_name
|
(identifier) @_name
|
||||||
arguments: (meta_arguments (meta_item (identifier) @type))
|
arguments: (meta_arguments (meta_item (identifier) @type))
|
||||||
(#eq? @_name "derive"))
|
(#eq? @_name "derive"))
|
||||||
|
|
||||||
|
;; Function-like macros
|
||||||
(macro_invocation
|
(macro_invocation
|
||||||
macro: (identifier) @function.macro)
|
macro: (identifier) @function.macro)
|
||||||
(macro_invocation
|
(macro_invocation
|
||||||
macro: (scoped_identifier
|
macro: (scoped_identifier
|
||||||
(identifier) @function.macro .))
|
(identifier) @function.macro .))
|
||||||
|
|
||||||
(metavariable) @function.macro
|
|
||||||
(meta_item (identifier) @function.macro)
|
|
||||||
(meta_item (scoped_identifier (identifier) @function.macro .))
|
|
||||||
|
|
||||||
|
|
||||||
"$" @function.macro
|
|
||||||
|
|
||||||
; Function definitions
|
; Function definitions
|
||||||
|
|
||||||
(function_item (identifier) @function)
|
(function_item (identifier) @function)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue