From 4c897d8d2dd047e0906d585318866c9ae7a21610 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 30 Mar 2020 14:38:01 +0300 Subject: Fix the endless progress bar issue --- crates/ra_cargo_watch/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/ra_cargo_watch/src/lib.rs') diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs index c67ec39d4..2692c1bf5 100644 --- a/crates/ra_cargo_watch/src/lib.rs +++ b/crates/ra_cargo_watch/src/lib.rs @@ -95,6 +95,9 @@ impl CheckWatcherThread { } fn run(&mut self, task_send: &Sender, cmd_recv: &Receiver) { + // If we rerun the thread, we need to discard the previous check results first + self.clean_previous_results(task_send); + loop { select! { recv(&cmd_recv) -> cmd => match cmd { @@ -127,6 +130,13 @@ impl CheckWatcherThread { } } + fn clean_previous_results(&self, task_send: &Sender) { + task_send.send(CheckTask::ClearDiagnostics).unwrap(); + task_send + .send(CheckTask::Status(WorkDoneProgress::End(WorkDoneProgressEnd { message: None }))) + .unwrap(); + } + fn should_recheck(&mut self) -> bool { if let Some(_last_update_req) = &self.last_update_req { // We currently only request an update on save, as we need up to -- cgit v1.2.3