fix: Fix formatting requests hanging when r-a is still starting
The reason for that was that we were calculating the crate defmaps of the file we are saving by accident causing us to get stuck waiting on their expensive computation, while we only need the relevant crate id.
This commit is contained in:
@@ -118,11 +118,7 @@ impl CargoTargetSpec {
|
||||
global_state_snapshot: &GlobalStateSnapshot,
|
||||
file_id: FileId,
|
||||
) -> Result<Option<CargoTargetSpec>> {
|
||||
let crate_id = match &*global_state_snapshot.analysis.crate_for(file_id)? {
|
||||
&[crate_id, ..] => crate_id,
|
||||
_ => return Ok(None),
|
||||
};
|
||||
let (cargo_ws, target) = match global_state_snapshot.cargo_target_for_crate_root(crate_id) {
|
||||
let (cargo_ws, target) = match global_state_snapshot.cargo_target_for_file_id(file_id) {
|
||||
Some(it) => it,
|
||||
None => return Ok(None),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user