rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Display the value of enum variants on hover

Open OleStrohm opened this issue 3 years ago • 1 comments
trafficstars

I've been wanting this feature, and so I've been working on it, and I've got something working, though it still requires a fair bit more work, but just to have a space for feedback I'm making this issue.

The feature I want is to be able to have an enum like

enum E {
    A = 5,
    B = 1 << 3,
}

which should display something like A = 5 or B = 8. When hovering on E::A it currently just displays A, which isn't very useful.

Currently consts like const C: u8 = 1 << 8; have this feature, and I think it would make a lot of sense to bring similar feature parity to enum variants.

This requires both updating the hover rendering of enum variants, but the bigger task is to provide proper const evaluation support, which I am currently working on implementing.

OleStrohm avatar Aug 06 '22 17:08 OleStrohm

@rustbot claim

OleStrohm avatar Aug 06 '22 17:08 OleStrohm