Skip to content

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

Open
@detly

Description

@detly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions