rust-analyzer/crates/ide/src
bors 817a6a8609 Auto merge of #12966 - OleStrohm:master, r=Veykril
feat: Display the value of enum variant on hover

fixes #12955

This PR adds const eval support for enums, as well as showing their value on hover, just as consts currently have.

I developed these two things at the same time, but I've realized now that they are separate. However since the hover is just a 10 line change (not including tests), I figured I may as well put them in the same PR. Though if you want them split up into "enum const eval support"  and "show enum variant value on hover", I think that's reasonable too.

Since this adds const eval support for enums this also allows consts that reference enums to have their values computed now too.

The const evaluation itself is quite rudimentary, it doesn't keep track of the actual type of the enum, but it turns out that Rust doesn't actually either, and `E::A as u8` is valid regardless of the `repr` on `E`.

It also doesn't really care about what expression the enum variant contains, it could for example be a string, despite that not being allowed, but I guess it's up to the `cargo check` diagnostics to inform of such issues anyway?
2022-09-20 14:01:16 +00:00
..
doc_links Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
hover Fixed lints 2022-09-12 21:27:19 +01:00
prime_caches Re-export FxHashMap and FxHashSet from ide_db 2022-04-25 18:51:59 +02:00
syntax_highlighting Fix operator highlighting tags applying too broadly 2022-09-20 14:33:44 +02:00
typing Add scary warning to onEnter 2022-02-28 12:15:15 +02:00
annotations.rs Move reference imports filtering into to_proto layer 2022-09-13 14:58:50 +02:00
call_hierarchy.rs fix: Fix incorrect token pick rankings 2022-08-05 14:59:26 +02:00
doc_links.rs Resolve doc links on impl blocks 2022-08-23 17:50:45 +02:00
expand_macro.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
extend_selection.rs Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
file_structure.rs more clippy fixes: 2022-03-12 16:50:49 +01:00
fixture.rs add some tests 2021-09-26 12:48:53 +03:30
fn_references.rs Rename *Owner traits to Has* 2021-09-27 12:54:24 +02:00
folding_ranges.rs feat: add fold range for multi line match arm list 2022-06-18 16:05:56 +08:00
goto_declaration.rs minor: Freshen up goto feature docs 2022-05-27 15:47:31 +02:00
goto_definition.rs Auto merge of #12982 - jridgewell:into_future, r=Veykril 2022-08-18 07:37:47 +00:00
goto_implementation.rs fix: Fix incorrect token pick rankings 2022-08-05 14:59:26 +02:00
goto_type_definition.rs Don't show trait flyimports for impl trait and placeholders 2021-12-10 19:18:21 +01:00
highlight_related.rs Move reference imports filtering into to_proto layer 2022-09-13 14:58:50 +02:00
hover.rs Add a setting for keyword hover popups 2022-08-16 16:51:40 +02:00
inlay_hints.rs docs(inlay-hints): remove reference to Toggle inlay hints 2022-09-19 12:00:58 -04:00
join_lines.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
lib.rs Move reference imports filtering into to_proto layer 2022-09-13 14:58:50 +02:00
markdown_remove.rs Remove more unreachable pubs 2020-11-02 16:58:33 +01:00
markup.rs Rename ra_ide -> ide 2020-08-13 17:58:27 +02:00
matching_brace.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
moniker.rs feat: emit SCIP via rust-analyzer 2022-08-22 15:13:46 -04:00
move_item.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
navigation_target.rs Record derive helper attributes, resolve them in IDE layer 2022-07-26 09:26:51 +02:00
parent_module.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
prime_caches.rs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
references.rs Move reference imports filtering into to_proto layer 2022-09-13 14:58:50 +02:00
rename.rs Run cargo fmt 2022-07-20 15:06:15 +02:00
runnables.rs Add test for runnables with raw identifiers 2022-08-11 03:41:23 +09:00
shuffle_crate_graph.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
signature_help.rs Record derive helper attributes, resolve them in IDE layer 2022-07-26 09:26:51 +02:00
ssr.rs Re-export FxHashMap and FxHashSet from ide_db 2022-04-25 18:51:59 +02:00
static_index.rs Add a setting for keyword hover popups 2022-08-16 16:51:40 +02:00
status.rs remove imports that are also in edition 2021's prelude 2022-08-09 01:16:32 +02:00
syntax_highlighting.rs Add config for macro bang token highlighting, disable by default 2022-08-23 14:05:56 +02:00
syntax_tree.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
typing.rs internal: Make autoclosing angle brackets configurable, disabled by default 2022-05-25 12:42:07 +02:00
view_crate_graph.rs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
view_hir.rs Add an HIR pretty-printer 2022-08-15 13:51:45 +02:00
view_item_tree.rs Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00