diff options
author | Aleksey Kladov <[email protected]> | 2019-01-18 13:36:56 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-19 12:37:25 +0000 |
commit | c0aeb5204c010a11db2015113a7858b517415de1 (patch) | |
tree | 0a41b5828fde247ce21af57c182235e935d3ffb8 /crates/ra_ide_api/src/completion | |
parent | b93c6bc5575db4acc5aa5867b6f0cc0dd37858f4 (diff) |
switched to lowerd module
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 699680748..4276e47e8 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use rustc_hash::FxHashSet; | 1 | use rustc_hash::FxHashSet; |
2 | use ra_syntax::TextUnit; | 2 | use ra_syntax::{AstNode, TextUnit}; |
3 | 3 | ||
4 | use crate::completion::{CompletionItem, CompletionItemKind, Completions, CompletionKind, CompletionContext}; | 4 | use crate::completion::{CompletionItem, CompletionItemKind, Completions, CompletionKind, CompletionContext}; |
5 | 5 | ||
@@ -17,18 +17,15 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | let module_scope = module.scope(ctx.db); | 19 | let module_scope = module.scope(ctx.db); |
20 | let (file_id, _) = module.definition_source(ctx.db); | ||
21 | module_scope | 20 | module_scope |
22 | .entries() | 21 | .entries() |
23 | .filter(|(_name, res)| { | 22 | .filter(|(_name, res)| { |
24 | // Don't expose this item | 23 | // For cases like `use self::foo<|>` don't suggest foo itself. |
25 | // FIXME: this penetrates through all kinds of abstractions, | ||
26 | // we need to figura out the way to do it less ugly. | ||
27 | match res.import { | 24 | match res.import { |
28 | None => true, | 25 | None => true, |
29 | Some(import) => { | 26 | Some(import) => { |
30 | let range = import.range(ctx.db, file_id); | 27 | let source = module.import_source(ctx.db, import); |
31 | !range.is_subrange(&ctx.leaf.range()) | 28 | !source.syntax().range().is_subrange(&ctx.leaf.range()) |
32 | } | 29 | } |
33 | } | 30 | } |
34 | }) | 31 | }) |