mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Merge #470
470: Type inference for enum variants r=flodiebold a=marcusklaas Opened a new PR instead of https://github.com/rust-analyzer/rust-analyzer/pull/461. Totally botched that one. I think I resolved all the issues mentioned there. Co-authored-by: Marcus Klaas de Vries <mail@marcusklaas.nl>
This commit is contained in:
commit
dc2a8d5acc
12 changed files with 205 additions and 46 deletions
|
@ -21,14 +21,15 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C
|
|||
.add_to(acc)
|
||||
});
|
||||
}
|
||||
hir::Def::Enum(e) => e
|
||||
.variants(ctx.db)?
|
||||
.into_iter()
|
||||
.for_each(|(name, _variant)| {
|
||||
CompletionItem::new(CompletionKind::Reference, name.to_string())
|
||||
.kind(CompletionItemKind::EnumVariant)
|
||||
.add_to(acc)
|
||||
}),
|
||||
hir::Def::Enum(e) => {
|
||||
e.variants(ctx.db)?
|
||||
.into_iter()
|
||||
.for_each(|(variant_name, _variant)| {
|
||||
CompletionItem::new(CompletionKind::Reference, variant_name.to_string())
|
||||
.kind(CompletionItemKind::EnumVariant)
|
||||
.add_to(acc)
|
||||
});
|
||||
}
|
||||
_ => return Ok(()),
|
||||
};
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue