From 0de89f786ffd71d56317853e1f3360f33b8e2ddf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Apr 2019 17:58:04 +0300 Subject: always produce source for import --- crates/ra_ide_api/src/completion/complete_path.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 122dd7bdd..e54fe7b7e 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -19,11 +19,14 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { for (name, res) in module_scope.entries() { if Some(module) == ctx.module { if let Some(import) = res.import { - let path = module.import_source(ctx.db, import); - if path.syntax().range().contains_inclusive(ctx.offset) { - // for `use self::foo<|>`, don't suggest `foo` as a completion - tested_by!(dont_complete_current_use); - continue; + if let hir::ImportSource::UseTree(tree) = + module.import_source(ctx.db, import) + { + if tree.syntax().range().contains_inclusive(ctx.offset) { + // for `use self::foo<|>`, don't suggest `foo` as a completion + tested_by!(dont_complete_current_use); + continue; + } } } } -- cgit v1.2.3