mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +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(())
|
||||
|
|
|
@ -122,6 +122,7 @@ salsa::database_storage! {
|
|||
fn type_for_field() for hir::db::TypeForFieldQuery;
|
||||
fn struct_data() for hir::db::StructDataQuery;
|
||||
fn enum_data() for hir::db::EnumDataQuery;
|
||||
fn enum_variant_data() for hir::db::EnumVariantDataQuery;
|
||||
fn impls_in_module() for hir::db::ImplsInModuleQuery;
|
||||
fn body_hir() for hir::db::BodyHirQuery;
|
||||
fn body_syntax_mapping() for hir::db::BodySyntaxMappingQuery;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue