Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/mod_.rs')
| -rw-r--r-- | crates/ide-completion/src/completions/mod_.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ide-completion/src/completions/mod_.rs b/crates/ide-completion/src/completions/mod_.rs index 78d0ef7122..3e03528f0c 100644 --- a/crates/ide-completion/src/completions/mod_.rs +++ b/crates/ide-completion/src/completions/mod_.rs @@ -30,7 +30,9 @@ pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Op // For `mod $0`, `ctx.module` is its parent, but for `mod f$0`, it's `mod f` itself, but we're // interested in its parent. if ctx.original_token.kind() == SyntaxKind::IDENT { - if let Some(module) = ctx.original_token.ancestors().nth(1).and_then(ast::Module::cast) { + if let Some(module) = + ctx.original_token.parent_ancestors().nth(1).and_then(ast::Module::cast) + { match ctx.sema.to_def(&module) { Some(module) if module == current_module => { if let Some(parent) = current_module.parent(ctx.db) { |