diff options
author | Aleksey Kladov <[email protected]> | 2019-04-10 08:46:43 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-10 08:48:15 +0100 |
commit | 10726fdb65fda9144a5f9201272d065a268fc1b7 (patch) | |
tree | f5640991cbf0db2bfdad29b911435827cadfb4a8 /crates/ra_ide_api/src/completion | |
parent | 1cd184d6539478c7e54c92835902921976dce5d1 (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.rs | 8 |
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 @@ | |||
1 | use hir::Resolution; | 1 | use hir::{Resolution, Either}; |
2 | use ra_syntax::AstNode; | 2 | use ra_syntax::AstNode; |
3 | use test_utils::tested_by; | 3 | use 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; |