mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Move CompletionContext::impl_def
into corresponding entities
This commit is contained in:
parent
83e8f3ac30
commit
c1446a2743
8 changed files with 97 additions and 48 deletions
|
@ -27,6 +27,7 @@ pub(crate) fn complete_expr_path(
|
|||
in_condition,
|
||||
ty,
|
||||
incomplete_let,
|
||||
impl_,
|
||||
) = match path_ctx {
|
||||
&PathCompletionCtx {
|
||||
kind:
|
||||
|
@ -39,6 +40,7 @@ pub(crate) fn complete_expr_path(
|
|||
ref ref_expr_parent,
|
||||
ref is_func_update,
|
||||
ref innermost_ret_ty,
|
||||
ref impl_,
|
||||
..
|
||||
},
|
||||
ref qualified,
|
||||
|
@ -53,6 +55,7 @@ pub(crate) fn complete_expr_path(
|
|||
in_condition,
|
||||
innermost_ret_ty,
|
||||
incomplete_let,
|
||||
impl_,
|
||||
),
|
||||
_ => return,
|
||||
};
|
||||
|
@ -181,8 +184,7 @@ pub(crate) fn complete_expr_path(
|
|||
if let Some(adt) =
|
||||
ctx.expected_type.as_ref().and_then(|ty| ty.strip_references().as_adt())
|
||||
{
|
||||
let self_ty =
|
||||
(|| ctx.sema.to_def(ctx.impl_def.as_ref()?)?.self_ty(ctx.db).as_adt())();
|
||||
let self_ty = (|| ctx.sema.to_def(impl_.as_ref()?)?.self_ty(ctx.db).as_adt())();
|
||||
let complete_self = self_ty == Some(adt);
|
||||
|
||||
match adt {
|
||||
|
@ -210,9 +212,15 @@ pub(crate) fn complete_expr_path(
|
|||
}
|
||||
}
|
||||
hir::Adt::Enum(e) => {
|
||||
super::enum_variants_with_paths(acc, ctx, e, |acc, ctx, variant, path| {
|
||||
acc.add_qualified_enum_variant(ctx, variant, path)
|
||||
});
|
||||
super::enum_variants_with_paths(
|
||||
acc,
|
||||
ctx,
|
||||
e,
|
||||
impl_,
|
||||
|acc, ctx, variant, path| {
|
||||
acc.add_qualified_enum_variant(ctx, variant, path)
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue