Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_completion/src/completions/vis.rs')
| -rw-r--r-- | crates/ide_completion/src/completions/vis.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ide_completion/src/completions/vis.rs b/crates/ide_completion/src/completions/vis.rs index 9cf9632658..c610dcd705 100644 --- a/crates/ide_completion/src/completions/vis.rs +++ b/crates/ide_completion/src/completions/vis.rs @@ -20,13 +20,14 @@ pub(crate) fn complete_vis(acc: &mut Completions, ctx: &CompletionContext) { match qualifier { Some(PathQualifierCtx { resolution, is_super_chain, .. }) => { + // Try completing next child module of the path that is still a parent of the current module if let Some(hir::PathResolution::Def(hir::ModuleDef::Module(module))) = resolution { if let Some(current_module) = ctx.module { let next_towards_current = current_module .path_to_root(ctx.db) .into_iter() .take_while(|it| it != module) - .next(); + .last(); if let Some(next) = next_towards_current { if let Some(name) = next.name(ctx.db) { cov_mark::hit!(visibility_qualified); |