mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -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)
|
name: (identifier) @constant)
|
||||||
; Assume all-caps names are constants
|
; Assume all-caps names are constants
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||||
|
|
||||||
; Other identifiers
|
; Other identifiers
|
||||||
|
|
||||||
|
|
@ -41,9 +41,12 @@
|
||||||
field: (field_identifier) @function))
|
field: (field_identifier) @function))
|
||||||
|
|
||||||
; Assume other uppercase names are enum constructors
|
; Assume other uppercase names are enum constructors
|
||||||
([(identifier) (field_identifier)] @constant
|
((field_identifier) @constant
|
||||||
(#match? @constant "^[A-Z]"))
|
(#match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
|
(enum_variant
|
||||||
|
name: (identifier) @constant)
|
||||||
|
|
||||||
; Assume that uppercase names in paths are types
|
; Assume that uppercase names in paths are types
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
path: (identifier) @namespace)
|
path: (identifier) @namespace)
|
||||||
|
|
@ -84,7 +87,7 @@
|
||||||
(metavariable) @function.macro
|
(metavariable) @function.macro
|
||||||
|
|
||||||
;; Attribute macros
|
;; Attribute macros
|
||||||
(meta_item (identifier) @function.macro)
|
(attribute_item (meta_item (identifier) @function.macro))
|
||||||
(meta_item (scoped_identifier (identifier) @function.macro .))
|
(meta_item (scoped_identifier (identifier) @function.macro .))
|
||||||
|
|
||||||
;; Derive macros (assume all arguments are types)
|
;; Derive macros (assume all arguments are types)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue