Skip to content

Commit 7bd85e9

Browse files
authored
Merge pull request #18741 from Veykril/push-nuqmzsrrltux
fix: Delay initial flycheck until after build scripts
2 parents c38d297 + eea63c2 commit 7bd85e9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub(crate) struct GlobalState {
9292

9393
// status
9494
pub(crate) shutdown_requested: bool,
95-
pub(crate) last_reported_status: Option<lsp_ext::ServerStatusParams>,
95+
pub(crate) last_reported_status: lsp_ext::ServerStatusParams,
9696

9797
// proc macros
9898
pub(crate) proc_macro_clients: Arc<[anyhow::Result<ProcMacroServer>]>,
@@ -238,7 +238,11 @@ impl GlobalState {
238238
mem_docs: MemDocs::default(),
239239
semantic_tokens_cache: Arc::new(Default::default()),
240240
shutdown_requested: false,
241-
last_reported_status: None,
241+
last_reported_status: lsp_ext::ServerStatusParams {
242+
health: lsp_ext::Health::Ok,
243+
quiescent: true,
244+
message: None,
245+
},
242246
source_root_config: SourceRootConfig::default(),
243247
local_roots_parent_map: Arc::new(FxHashMap::default()),
244248
config_errors: Default::default(),

src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ impl GlobalState {
408408
if self.is_quiescent() {
409409
let became_quiescent = !was_quiescent;
410410
if became_quiescent {
411-
if self.config.check_on_save(None) && self.config.flycheck_workspace(None) {
411+
if self.config.check_on_save(None)
412+
&& self.config.flycheck_workspace(None)
413+
&& !self.fetch_build_data_queue.op_requested()
414+
{
412415
// Project has loaded properly, kick off initial flycheck
413416
self.flycheck.iter().for_each(|flycheck| flycheck.restart_workspace(None));
414417
}
@@ -656,8 +659,8 @@ impl GlobalState {
656659

657660
fn update_status_or_notify(&mut self) {
658661
let status = self.current_status();
659-
if self.last_reported_status.as_ref() != Some(&status) {
660-
self.last_reported_status = Some(status.clone());
662+
if self.last_reported_status != status {
663+
self.last_reported_status = status.clone();
661664

662665
if self.config.server_status_notification() {
663666
self.send_notification::<lsp_ext::ServerStatusNotification>(status);

src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ impl GlobalState {
7070
/// are ready to do semantic work.
7171
pub(crate) fn is_quiescent(&self) -> bool {
7272
self.vfs_done
73-
&& self.last_reported_status.is_some()
7473
&& !self.fetch_workspaces_queue.op_in_progress()
7574
&& !self.fetch_build_data_queue.op_in_progress()
7675
&& !self.fetch_proc_macros_queue.op_in_progress()

0 commit comments

Comments
 (0)