diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_path.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 2aec8eb26..9ac9768af 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -50,25 +50,19 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
50 | hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db), | 50 | hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db), |
51 | _ => unreachable!(), | 51 | _ => unreachable!(), |
52 | }; | 52 | }; |
53 | ctx.analyzer.iterate_method_candidates( | 53 | ctx.analyzer.iterate_path_candidates(ctx.db, ty.clone(), None, |_ty, item| { |
54 | ctx.db, | 54 | match item { |
55 | ty.clone(), | 55 | hir::AssocItem::Function(func) => { |
56 | None, | 56 | let data = func.data(ctx.db); |
57 | hir::LookupMode::Path, | 57 | if !data.has_self_param() { |
58 | |_ty, item| { | 58 | acc.add_function(ctx, func); |
59 | match item { | ||
60 | hir::AssocItem::Function(func) => { | ||
61 | let data = func.data(ctx.db); | ||
62 | if !data.has_self_param() { | ||
63 | acc.add_function(ctx, func); | ||
64 | } | ||
65 | } | 59 | } |
66 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), | ||
67 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | ||
68 | } | 60 | } |
69 | None::<()> | 61 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), |
70 | }, | 62 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), |
71 | ); | 63 | } |
64 | None::<()> | ||
65 | }); | ||
72 | // Iterate assoc types separately | 66 | // Iterate assoc types separately |
73 | // FIXME: complete T::AssocType | 67 | // FIXME: complete T::AssocType |
74 | let krate = ctx.module.map(|m| m.krate()); | 68 | let krate = ctx.module.map(|m| m.krate()); |