mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Prepare SourceDatabase API for lazy file loading
This commit is contained in:
parent
1555a1aa0d
commit
abf2179c0b
14 changed files with 123 additions and 90 deletions
|
@ -189,14 +189,14 @@ impl Module {
|
|||
ModuleSource::SourceFile(_) => None,
|
||||
};
|
||||
|
||||
let source_root_id = db.file_source_root(src.file_id.original_file(db));
|
||||
db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map(
|
||||
|krate| {
|
||||
db.relevant_crates(src.file_id.original_file(db))
|
||||
.iter()
|
||||
.map(|&crate_id| Crate { crate_id })
|
||||
.find_map(|krate| {
|
||||
let def_map = db.crate_def_map(krate);
|
||||
let module_id = def_map.find_module_by_source(src.file_id, decl_id)?;
|
||||
Some(Module { krate, module_id })
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue