diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-12-22 14:28:17 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-12-22 14:28:17 +0100 |
| commit | 6604f22c02a55fbd03af339400bbbd1fa001cdf5 (patch) | |
| tree | 701f4634aa333e31b80b879f65476a581c9eb6f5 | |
| parent | c38d297b9f4701e31b70bb755cb45161bef5f739 (diff) | |
| download | rust-6604f22c02a55fbd03af339400bbbd1fa001cdf5.tar.gz rust-6604f22c02a55fbd03af339400bbbd1fa001cdf5.zip | |
fix: Fix flycheck workspace when requested but package was found
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs index 83c425bd71b..c0231fd04e5 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs @@ -293,7 +293,6 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { let file_id = state.vfs.read().0.file_id(&vfs_path); if let Some(file_id) = file_id { let world = state.snapshot(); - let source_root_id = world.analysis.source_root_id(file_id).ok(); let may_flycheck_workspace = state.config.flycheck_workspace(None); let mut updated = false; let task = move || -> std::result::Result<(), ide::Cancelled> { @@ -376,16 +375,17 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { let saved_file = vfs_path.as_path().map(|p| p.to_owned()); // Find and trigger corresponding flychecks - for flycheck in world.flycheck.iter() { + 'flychecks: for flycheck in world.flycheck.iter() { for (id, package) in workspace_ids.clone() { if id == flycheck.id() { updated = true; - match package.filter(|_| !world.config.flycheck_workspace(source_root_id)) { - Some(package) => flycheck - .restart_for_package(package, target.clone().map(TupleExt::head)), - None => flycheck.restart_workspace(saved_file.clone()), + if may_flycheck_workspace { + flycheck.restart_workspace(saved_file.clone()) + } else if let Some(package) = package { + flycheck + .restart_for_package(package, target.clone().map(TupleExt::head)) } - continue; + continue 'flychecks; } } } |
