Skip to content

Commit 4c897d8

Browse files
Fix the endless progress bar issue
1 parent 8e78371 commit 4c897d8

File tree

1 file changed

+10
-0
lines changed
  • crates/ra_cargo_watch/src

1 file changed

+10
-0
lines changed

crates/ra_cargo_watch/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ impl CheckWatcherThread {
9595
}
9696

9797
fn run(&mut self, task_send: &Sender<CheckTask>, cmd_recv: &Receiver<CheckCommand>) {
98+
// If we rerun the thread, we need to discard the previous check results first
99+
self.clean_previous_results(task_send);
100+
98101
loop {
99102
select! {
100103
recv(&cmd_recv) -> cmd => match cmd {
@@ -127,6 +130,13 @@ impl CheckWatcherThread {
127130
}
128131
}
129132

133+
fn clean_previous_results(&self, task_send: &Sender<CheckTask>) {
134+
task_send.send(CheckTask::ClearDiagnostics).unwrap();
135+
task_send
136+
.send(CheckTask::Status(WorkDoneProgress::End(WorkDoneProgressEnd { message: None })))
137+
.unwrap();
138+
}
139+
130140
fn should_recheck(&mut self) -> bool {
131141
if let Some(_last_update_req) = &self.last_update_req {
132142
// We currently only request an update on save, as we need up to

0 commit comments

Comments
 (0)