mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
fix: Fix DidSaveDocument requests blocking the server on startup
This commit is contained in:
parent
f3cce5feea
commit
de195ff97c
7 changed files with 132 additions and 83 deletions
|
@ -1,8 +1,9 @@
|
|||
use hir::Semantics;
|
||||
use hir::{db::DefDatabase, Semantics};
|
||||
use ide_db::{
|
||||
base_db::{CrateId, FileId, FileLoader, FilePosition},
|
||||
RootDatabase,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use syntax::{
|
||||
algo::find_node_at_offset,
|
||||
ast::{self, AstNode},
|
||||
|
@ -55,7 +56,12 @@ pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<Na
|
|||
|
||||
/// Returns `Vec` for the same reason as `parent_module`
|
||||
pub(crate) fn crates_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> {
|
||||
db.relevant_crates(file_id).iter().copied().collect()
|
||||
db.relevant_crates(file_id)
|
||||
.iter()
|
||||
.copied()
|
||||
.filter(|&crate_id| db.crate_def_map(crate_id).modules_for_file(file_id).next().is_some())
|
||||
.sorted()
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue