mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
switched to lowerd module
This commit is contained in:
parent
b93c6bc557
commit
c0aeb5204c
9 changed files with 284 additions and 65 deletions
|
@ -1,5 +1,5 @@
|
|||
use rustc_hash::FxHashSet;
|
||||
use ra_syntax::TextUnit;
|
||||
use ra_syntax::{AstNode, TextUnit};
|
||||
|
||||
use crate::completion::{CompletionItem, CompletionItemKind, Completions, CompletionKind, CompletionContext};
|
||||
|
||||
|
@ -17,18 +17,15 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
}
|
||||
|
||||
let module_scope = module.scope(ctx.db);
|
||||
let (file_id, _) = module.definition_source(ctx.db);
|
||||
module_scope
|
||||
.entries()
|
||||
.filter(|(_name, res)| {
|
||||
// Don't expose this item
|
||||
// FIXME: this penetrates through all kinds of abstractions,
|
||||
// we need to figura out the way to do it less ugly.
|
||||
// For cases like `use self::foo<|>` don't suggest foo itself.
|
||||
match res.import {
|
||||
None => true,
|
||||
Some(import) => {
|
||||
let range = import.range(ctx.db, file_id);
|
||||
!range.is_subrange(&ctx.leaf.range())
|
||||
let source = module.import_source(ctx.db, import);
|
||||
!source.syntax().range().is_subrange(&ctx.leaf.range())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -114,6 +114,9 @@ salsa::database_storage! {
|
|||
fn file_items() for hir::db::FileItemsQuery;
|
||||
fn file_item() for hir::db::FileItemQuery;
|
||||
fn input_module_items() for hir::db::InputModuleItemsQuery;
|
||||
fn lower_module() for hir::db::LowerModuleQuery;
|
||||
fn lower_module_module() for hir::db::LowerModuleModuleQuery;
|
||||
fn lower_module_source_map() for hir::db::LowerModuleSourceMapQuery;
|
||||
fn item_map() for hir::db::ItemMapQuery;
|
||||
fn submodules() for hir::db::SubmodulesQuery;
|
||||
fn infer() for hir::db::InferQuery;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue