From f05f471185f6106a86c4ab5e57015db2faab31e0 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Thu, 30 Sep 2021 22:13:18 -0500 Subject: [PATCH] Rust: fix some highlights Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/1856 --- queries/rust/highlights.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 94301fc2e..1d5f3d736 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -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)