rust-lang/rust-enhanced

Enum variants with only a single uppercase letter and digits have "constant" scope applied

Opened this issue ยท 0 comments

detly commented

Sublime Text Version

Sublime Text 4 (Build 4142)

Rust Enhanced Version

v2.25.0

Operating system

Ubuntu 22.10, Gnome 43.0

Expected behavior

enum HayesCommand {
    /// Commands per the V.250 aka V.25TER AT standard, plus the ETSI TS 127 007
    /// standard.
    V250(v250::Command),
    /// Extensions to the above that we support.
    Extension(extension::Command),
}

Both V250 and Extension should have the same scopes applied, since there is no syntactical difference between them ie. they are both variants of an enum. Neither trigger a compiler or clippy warning.

(I'm not particularly tied to V250 as a name, nor do I mind the inconsistent highlighting for this single example. I just noticed it because V250 is the first abbreviation of "V.250" I thought of that was syntactically allowed, and here we are.)

Actual behavior

The text V250 has the following scopes:

source.rust
meta.block.rust
meta.enum.rust
constant.other.rust ๐Ÿ‘ˆ 

Extension has the following scopes:

source.rust
meta.block.rust
meta.enum.rust
storage.type.source.rust ๐Ÿ‘ˆ

Many syntax highlighting schemes, including the default Monokai, highlight these differently:

Screenshot from 2022-12-05 00-36-27

Steps to reproduce

Code above.