diff options
Diffstat (limited to 'crates/completion/src/lib.rs')
-rw-r--r-- | crates/completion/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 56ec13e8c..2c4e54524 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -11,10 +11,10 @@ mod render; | |||
11 | 11 | ||
12 | mod completions; | 12 | mod completions; |
13 | 13 | ||
14 | use completions::flyimport::position_for_import; | ||
14 | use ide_db::{ | 15 | use ide_db::{ |
15 | base_db::FilePosition, helpers::insert_use::ImportScope, imports_locator, RootDatabase, | 16 | base_db::FilePosition, helpers::insert_use::ImportScope, imports_locator, RootDatabase, |
16 | }; | 17 | }; |
17 | use syntax::AstNode; | ||
18 | use text_edit::TextEdit; | 18 | use text_edit::TextEdit; |
19 | 19 | ||
20 | use crate::{completions::Completions, context::CompletionContext, item::CompletionKind}; | 20 | use crate::{completions::Completions, context::CompletionContext, item::CompletionKind}; |
@@ -142,10 +142,10 @@ pub fn resolve_completion_edits( | |||
142 | import_for_trait_assoc_item: bool, | 142 | import_for_trait_assoc_item: bool, |
143 | ) -> Option<Vec<TextEdit>> { | 143 | ) -> Option<Vec<TextEdit>> { |
144 | let ctx = CompletionContext::new(db, position, config)?; | 144 | let ctx = CompletionContext::new(db, position, config)?; |
145 | let anchor = ctx.name_ref_syntax.as_ref()?; | 145 | let position_for_import = position_for_import(&ctx, None)?; |
146 | let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?; | 146 | let import_scope = ImportScope::find_insert_use_container(position_for_import, &ctx.sema)?; |
147 | 147 | ||
148 | let current_module = ctx.sema.scope(anchor.syntax()).module()?; | 148 | let current_module = ctx.sema.scope(position_for_import).module()?; |
149 | let current_crate = current_module.krate(); | 149 | let current_crate = current_module.krate(); |
150 | 150 | ||
151 | let import_path = imports_locator::find_exact_imports(&ctx.sema, current_crate, imported_name) | 151 | let import_path = imports_locator::find_exact_imports(&ctx.sema, current_crate, imported_name) |