diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index ae364f8627c..7e96f3c4a07 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -454,7 +454,9 @@ impl GlobalState { } } - self.fetch_workspaces_if_needed(); + if self.config.cargo_autoreload() { + self.fetch_workspaces_if_needed(); + } self.fetch_build_data_if_needed(); let loop_duration = loop_start.elapsed(); @@ -494,7 +496,10 @@ impl GlobalState { } RequestDispatcher { req: Some(req), global_state: self } - .on_sync::(|s, ()| Ok(s.fetch_workspaces_request()))? + .on_sync::(|s, ()| { + self.fetch_workspaces_request(); + self.fetch_workspaces_if_needed(); + })? .on_sync::(|s, p| handlers::handle_join_lines(s.snapshot(), p))? .on_sync::(|s, p| handlers::handle_on_enter(s.snapshot(), p))? .on_sync::(|s, ()| { diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index a8ae56070fa..5ff60c22aae 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -60,11 +60,7 @@ impl GlobalState { ", " ) ); - if self.config.cargo_autoreload() { - self.fetch_workspaces_request(); - } else { - self.transition(Status::NeedsReload); - } + self.fetch_workspaces_request(); fn is_interesting(path: &AbsPath, change_kind: ChangeKind) -> bool { const IMPLICIT_TARGET_FILES: &[&str] = &["build.rs", "src/main.rs", "src/lib.rs"];