mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 12:06:55 -04:00
Rust: fix some highlights
Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/1856
This commit is contained in:
parent
2d1c26a89d
commit
f05f471185
1 changed files with 6 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
name: (identifier) @constant)
|
||||
; Assume all-caps names are constants
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
; Other identifiers
|
||||
|
||||
|
|
@ -41,9 +41,12 @@
|
|||
field: (field_identifier) @function))
|
||||
|
||||
; Assume other uppercase names are enum constructors
|
||||
([(identifier) (field_identifier)] @constant
|
||||
((field_identifier) @constant
|
||||
(#match? @constant "^[A-Z]"))
|
||||
|
||||
(enum_variant
|
||||
name: (identifier) @constant)
|
||||
|
||||
; Assume that uppercase names in paths are types
|
||||
(scoped_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
|
@ -84,7 +87,7 @@
|
|||
(metavariable) @function.macro
|
||||
|
||||
;; Attribute macros
|
||||
(meta_item (identifier) @function.macro)
|
||||
(attribute_item (meta_item (identifier) @function.macro))
|
||||
(meta_item (scoped_identifier (identifier) @function.macro .))
|
||||
|
||||
;; Derive macros (assume all arguments are types)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue