diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 11 | ||||
-rw-r--r-- | crates/ra_ide_api/src/db.rs | 3 |
2 files changed, 7 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 | }) |
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index 36778b955..a1d3333b2 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs | |||
@@ -114,6 +114,9 @@ salsa::database_storage! { | |||
114 | fn file_items() for hir::db::FileItemsQuery; | 114 | fn file_items() for hir::db::FileItemsQuery; |
115 | fn file_item() for hir::db::FileItemQuery; | 115 | fn file_item() for hir::db::FileItemQuery; |
116 | fn input_module_items() for hir::db::InputModuleItemsQuery; | 116 | fn input_module_items() for hir::db::InputModuleItemsQuery; |
117 | fn lower_module() for hir::db::LowerModuleQuery; | ||
118 | fn lower_module_module() for hir::db::LowerModuleModuleQuery; | ||
119 | fn lower_module_source_map() for hir::db::LowerModuleSourceMapQuery; | ||
117 | fn item_map() for hir::db::ItemMapQuery; | 120 | fn item_map() for hir::db::ItemMapQuery; |
118 | fn submodules() for hir::db::SubmodulesQuery; | 121 | fn submodules() for hir::db::SubmodulesQuery; |
119 | fn infer() for hir::db::InferQuery; | 122 | fn infer() for hir::db::InferQuery; |