diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index bc03a7095..c41752ae7 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -38,19 +38,22 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
38 | } | 38 | } |
39 | hir::ModuleDef::Struct(s) => { | 39 | hir::ModuleDef::Struct(s) => { |
40 | let ty = s.ty(ctx.db); | 40 | let ty = s.ty(ctx.db); |
41 | ty.iterate_impl_items(ctx.db, |item| { | 41 | let krate = ctx.module.and_then(|m| m.krate(ctx.db)); |
42 | match item { | 42 | if let Some(krate) = krate { |
43 | hir::ImplItem::Method(func) => { | 43 | ty.iterate_impl_items(ctx.db, krate, |item| { |
44 | let sig = func.signature(ctx.db); | 44 | match item { |
45 | if !sig.has_self_param() { | 45 | hir::ImplItem::Method(func) => { |
46 | acc.add_function(ctx, func); | 46 | let sig = func.signature(ctx.db); |
47 | if !sig.has_self_param() { | ||
48 | acc.add_function(ctx, func); | ||
49 | } | ||
47 | } | 50 | } |
51 | hir::ImplItem::Const(ct) => acc.add_const(ctx, ct), | ||
52 | hir::ImplItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | ||
48 | } | 53 | } |
49 | hir::ImplItem::Const(ct) => acc.add_const(ctx, ct), | 54 | None::<()> |
50 | hir::ImplItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | 55 | }); |
51 | } | 56 | } |
52 | None::<()> | ||
53 | }); | ||
54 | } | 57 | } |
55 | _ => return, | 58 | _ => return, |
56 | }; | 59 | }; |