diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 29be53cee1..dd13bdba4c 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -92,7 +92,7 @@ pub(crate) struct GlobalState { // status pub(crate) shutdown_requested: bool, - pub(crate) last_reported_status: Option, + pub(crate) last_reported_status: lsp_ext::ServerStatusParams, // proc macros pub(crate) proc_macro_clients: Arc<[anyhow::Result]>, @@ -238,7 +238,11 @@ impl GlobalState { mem_docs: MemDocs::default(), semantic_tokens_cache: Arc::new(Default::default()), shutdown_requested: false, - last_reported_status: None, + last_reported_status: lsp_ext::ServerStatusParams { + health: lsp_ext::Health::Ok, + quiescent: true, + message: None, + }, source_root_config: SourceRootConfig::default(), local_roots_parent_map: Arc::new(FxHashMap::default()), config_errors: Default::default(), diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 2101f6443e..d97d96d54a 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -408,7 +408,10 @@ impl GlobalState { if self.is_quiescent() { let became_quiescent = !was_quiescent; if became_quiescent { - if self.config.check_on_save(None) && self.config.flycheck_workspace(None) { + if self.config.check_on_save(None) + && self.config.flycheck_workspace(None) + && !self.fetch_build_data_queue.op_requested() + { // Project has loaded properly, kick off initial flycheck self.flycheck.iter().for_each(|flycheck| flycheck.restart_workspace(None)); } @@ -656,8 +659,8 @@ impl GlobalState { fn update_status_or_notify(&mut self) { let status = self.current_status(); - if self.last_reported_status.as_ref() != Some(&status) { - self.last_reported_status = Some(status.clone()); + if self.last_reported_status != status { + self.last_reported_status = status.clone(); if self.config.server_status_notification() { self.send_notification::(status); diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index 4549735fef..3444773695 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -70,7 +70,6 @@ impl GlobalState { /// are ready to do semantic work. pub(crate) fn is_quiescent(&self) -> bool { self.vfs_done - && self.last_reported_status.is_some() && !self.fetch_workspaces_queue.op_in_progress() && !self.fetch_build_data_queue.op_in_progress() && !self.fetch_proc_macros_queue.op_in_progress()