Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #21709 from Wilfred/race_condition_flycheck_workspaces
fix: Incorrect flychecks with multiple workspaces
Lukas Wirth 8 weeks ago
parent 29a0c1e · parent 2b438d7 · commit 17e7f0c
-rw-r--r--crates/rust-analyzer/src/flycheck.rs2
-rw-r--r--crates/rust-analyzer/src/handlers/notification.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/flycheck.rs b/crates/rust-analyzer/src/flycheck.rs
index cdaf944bba..c41696bf3f 100644
--- a/crates/rust-analyzer/src/flycheck.rs
+++ b/crates/rust-analyzer/src/flycheck.rs
@@ -1021,7 +1021,7 @@ impl JsonLinesParser<CheckMessage> for CheckParser {
}
}
-#[derive(Deserialize)]
+#[derive(Deserialize, Debug)]
#[serde(untagged)]
enum JsonMessage {
Cargo(cargo_metadata::Message),
diff --git a/crates/rust-analyzer/src/handlers/notification.rs b/crates/rust-analyzer/src/handlers/notification.rs
index 138310b78f..09b6794e4f 100644
--- a/crates/rust-analyzer/src/handlers/notification.rs
+++ b/crates/rust-analyzer/src/handlers/notification.rs
@@ -295,8 +295,9 @@ pub(crate) fn handle_did_change_watched_files(
for change in params.changes.iter().unique_by(|&it| &it.uri) {
if let Ok(path) = from_proto::abs_path(&change.uri) {
if !trigger_flycheck {
+ // Trigger if no workspaces contain this file.
trigger_flycheck =
- state.config.workspace_roots().iter().any(|root| !path.starts_with(root));
+ state.config.workspace_roots().iter().all(|root| !path.starts_with(root));
}
state.loader.handle.invalidate(path);
}