aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-10 08:46:43 +0100
committerAleksey Kladov <[email protected]>2019-04-10 08:48:15 +0100
commit10726fdb65fda9144a5f9201272d065a268fc1b7 (patch)
treef5640991cbf0db2bfdad29b911435827cadfb4a8 /crates/ra_ide_api/src/completion
parent1cd184d6539478c7e54c92835902921976dce5d1 (diff)
type-safer source-map for bindings
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs8
1 files changed, 3 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 e54fe7b7e..7e47fa6bd 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -1,4 +1,4 @@
1use hir::Resolution; 1use hir::{Resolution, Either};
2use ra_syntax::AstNode; 2use ra_syntax::AstNode;
3use test_utils::tested_by; 3use test_utils::tested_by;
4 4
@@ -19,10 +19,8 @@ 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 if let hir::ImportSource::UseTree(tree) = 22 if let Either::A(use_tree) = module.import_source(ctx.db, import) {
23 module.import_source(ctx.db, import) 23 if use_tree.syntax().range().contains_inclusive(ctx.offset) {
24 {
25 if tree.syntax().range().contains_inclusive(ctx.offset) {
26 // for `use self::foo<|>`, don't suggest `foo` as a completion 24 // for `use self::foo<|>`, don't suggest `foo` as a completion
27 tested_by!(dont_complete_current_use); 25 tested_by!(dont_complete_current_use);
28 continue; 26 continue;