zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.87k stars 2.68k forks source link

Rust: Enum Variants with no lower-case highlighted as constants #14489

Open DragonDev1906 opened 2 months ago

DragonDev1906 commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Enum variants that do not contain lower-case letters (for example because they consist of one upper-case letter followed by numbers, e.g. U256) are syntax highlighted as if they are constants (see screenshot).

None of these are constants (they are all an enum variants (subtype?) and should be highlighted the same way. Having them in different colors is especially noticeable and confusing in match statements.

Theme used in the screenshot: Catpuchin (extension) Installed-by-default Theme where this is also visible: One Dark, One Light (and likely many more)

Example in screenshot

enum Test {
    Hello,
    World,
    U256,
    HELLO,
    WORLD,
}

Environment

Zed: v0.143.7 (Zed) OS: Linux X11 arch unknown Memory: 31 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

2024-07-15-135528_455x414_scrot

If applicable, attach your Zed.log file to this issue.

No response

osiewicz commented 2 months ago

We'd probably need something like sematic tokens support to correctly tell whether an identifier belongs to an enum or to a global constant.