fix: Fix DidSaveDocument requests blocking the server on startup

This commit is contained in:
Lukas Wirth 2022-10-20 19:28:28 +02:00
parent f3cce5feea
commit de195ff97c
7 changed files with 132 additions and 83 deletions

View file

@ -486,6 +486,16 @@ impl Analysis {
self.with_db(|db| parent_module::crates_for(db, file_id))
}
/// Returns crates this file belongs too.
pub fn transitive_rev_deps(&self, crate_id: CrateId) -> Cancellable<Vec<CrateId>> {
self.with_db(|db| db.crate_graph().transitive_rev_deps(crate_id).collect())
}
/// Returns crates this file *might* belong too.
pub fn relevant_crates_for(&self, file_id: FileId) -> Cancellable<Vec<CrateId>> {
self.with_db(|db| db.relevant_crates(file_id).iter().copied().collect())
}
/// Returns the edition of the given crate.
pub fn crate_edition(&self, crate_id: CrateId) -> Cancellable<Edition> {
self.with_db(|db| db.crate_graph()[crate_id].edition)