mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00:02 -04:00
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 (`#`, `#!`)
This commit is contained in:
parent
943edbda00
commit
709f3a73b3
1 changed files with 10 additions and 7 deletions
|
|
@ -81,9 +81,9 @@
|
||||||
|
|
||||||
;; Assume that all `#[derive]` arguments are types
|
;; Assume that all `#[derive]` arguments are types
|
||||||
(meta_item
|
(meta_item
|
||||||
(identifier) @type
|
(identifier) @_name
|
||||||
arguments: (meta_arguments (meta_item (identifier) @type))
|
arguments: (meta_arguments (meta_item (identifier) @type))
|
||||||
(#eq? @type "derive"))
|
(#eq? @_name "derive"))
|
||||||
|
|
||||||
(macro_invocation
|
(macro_invocation
|
||||||
macro: (identifier) @function.macro)
|
macro: (identifier) @function.macro)
|
||||||
|
|
@ -92,6 +92,9 @@
|
||||||
(identifier) @function.macro .))
|
(identifier) @function.macro .))
|
||||||
|
|
||||||
(metavariable) @function.macro
|
(metavariable) @function.macro
|
||||||
|
(meta_item (identifier) @function.macro)
|
||||||
|
(meta_item (scoped_identifier (identifier) @function.macro .))
|
||||||
|
|
||||||
|
|
||||||
"$" @function.macro
|
"$" @function.macro
|
||||||
|
|
||||||
|
|
@ -126,7 +129,10 @@
|
||||||
"."
|
"."
|
||||||
";"
|
";"
|
||||||
","
|
","
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
(attribute_item "#" @punctuation.special)
|
||||||
|
(inner_attribute_item ["#" "!"] @punctuation.special)
|
||||||
|
|
||||||
(parameter (identifier) @parameter)
|
(parameter (identifier) @parameter)
|
||||||
(closure_parameters (_) @parameter)
|
(closure_parameters (_) @parameter)
|
||||||
|
|
@ -166,10 +172,7 @@
|
||||||
"where"
|
"where"
|
||||||
(mutable_specifier)
|
(mutable_specifier)
|
||||||
(super)
|
(super)
|
||||||
; TODO(vigoux): attribute items should have some kind of injections
|
] @keyword
|
||||||
(attribute_item)
|
|
||||||
(inner_attribute_item)
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
"fn" @keyword.function
|
"fn" @keyword.function
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue