Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
detly opened this issue Dec 4, 2022 · 0 comments

Comments

@detly
Copy link

detly commented Dec 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant