Implement type inference for enum variants
This commit is contained in:
@@ -21,14 +21,20 @@ 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)?
|
||||
.unwrap_or(vec![])
|
||||
.into_iter()
|
||||
.for_each(|variant| {
|
||||
let variant_name = variant.name(ctx.db);
|
||||
|
||||
if let Ok(Some(name)) = variant_name {
|
||||
CompletionItem::new(CompletionKind::Reference, name.to_string())
|
||||
.kind(CompletionItemKind::EnumVariant)
|
||||
.add_to(acc)
|
||||
}
|
||||
})
|
||||
}
|
||||
_ => return Ok(()),
|
||||
};
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user