aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-02 15:58:27 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-02 15:58:27 +0100
commit9e46400e0ca72099fb5f464fdf6eefbace10fbd4 (patch)
treed6b13431cc32ca74c696166233aec7b44d331ea8 /crates/ra_ide_api
parent0a758a2c4803c7ecc956d2aa6ed2ce48c4e4edd9 (diff)
parent0de89f786ffd71d56317853e1f3360f33b8e2ddf (diff)
Merge #1092
1092: always produce source for import r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs13
1 files changed, 8 insertions, 5 deletions
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) {
19 for (name, res) in module_scope.entries() { 19 for (name, res) in module_scope.entries() {
20 if Some(module) == ctx.module { 20 if Some(module) == ctx.module {
21 if let Some(import) = res.import { 21 if let Some(import) = res.import {
22 let path = module.import_source(ctx.db, import); 22 if let hir::ImportSource::UseTree(tree) =
23 if path.syntax().range().contains_inclusive(ctx.offset) { 23 module.import_source(ctx.db, import)
24 // for `use self::foo<|>`, don't suggest `foo` as a completion 24 {
25 tested_by!(dont_complete_current_use); 25 if tree.syntax().range().contains_inclusive(ctx.offset) {
26 continue; 26 // for `use self::foo<|>`, don't suggest `foo` as a completion
27 tested_by!(dont_complete_current_use);
28 continue;
29 }
27 } 30 }
28 } 31 }
29 } 32 }