diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-12-22 13:32:48 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-22 13:32:48 +0000 |
| commit | 7bd85e99bd979d84ccfa2f4fca6813406d57cbf4 (patch) | |
| tree | 6309c15f484ac97b71bcdb2d4aae11fe1d91aa08 /src | |
| parent | c38d297b9f4701e31b70bb755cb45161bef5f739 (diff) | |
| parent | eea63c2473fd8d1f34d156979e1efaa75df9997a (diff) | |
| download | rust-7bd85e99bd979d84ccfa2f4fca6813406d57cbf4.tar.gz rust-7bd85e99bd979d84ccfa2f4fca6813406d57cbf4.zip | |
Merge pull request #18741 from Veykril/push-nuqmzsrrltux
fix: Delay initial flycheck until after build scripts
Diffstat (limited to 'src')
3 files changed, 12 insertions, 6 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs index 29be53cee1d..dd13bdba4cb 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs +++ b/src/tools/rust-analyzer/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<lsp_ext::ServerStatusParams>, + pub(crate) last_reported_status: lsp_ext::ServerStatusParams, // proc macros pub(crate) proc_macro_clients: Arc<[anyhow::Result<ProcMacroServer>]>, @@ -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/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs index 2101f6443ea..d97d96d54a0 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs +++ b/src/tools/rust-analyzer/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::<lsp_ext::ServerStatusNotification>(status); diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs index 4549735fef8..3444773695b 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs +++ b/src/tools/rust-analyzer/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() |
