aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rust
diff options
context:
space:
mode:
authorSantos Gallegos <stsewd@protonmail.com>2021-09-30 22:13:18 -0500
committerStephan Seitz <stephan.seitz@fau.de>2021-10-01 19:05:19 +0200
commitf05f471185f6106a86c4ab5e57015db2faab31e0 (patch)
tree8f880d08430934918f621180a1cee265529f8c5c /queries/rust
parenthighlight `description` as a comment (diff)
downloadnvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.tar
nvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.tar.gz
nvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.tar.bz2
nvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.tar.lz
nvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.tar.xz
nvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.tar.zst
nvim-treesitter-f05f471185f6106a86c4ab5e57015db2faab31e0.zip
Rust: fix some highlights
Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/1856
Diffstat (limited to 'queries/rust')
-rw-r--r--queries/rust/highlights.scm9
1 files 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)