rust: Highlight enum variants as types (#45546)

Closes [#ISSUE](https://github.com/zed-industries/zed/issues/14489)

Release Notes:

- Fix Rust enum variants with no lower-case highlighted as constants

Screenshot:

<img width="401" height="280" alt="image"
src="https://github.com/user-attachments/assets/cd67a576-3c41-452d-9c6b-b3c259cee556"
/>
This commit is contained in:
Rocky Shi 2026-01-23 00:52:14 +13:00 committed by GitHub
parent f1e87022a7
commit 73515d9ebd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,6 +57,9 @@
((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
; Ensure enum variants are highlighted correctly regardless of naming convention
(enum_variant name: (identifier) @type)
[
"("
")"