From 44b8737cedc437ec4981e73c1543b04f723656fa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Jul 2020 13:05:34 +0200 Subject: Dont show empty progress for empty workspaces --- crates/rust-analyzer/src/main_loop.rs | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 9fd16ef3b..2ce1441b6 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -168,22 +168,24 @@ impl GlobalState { } } vfs::loader::Message::Progress { n_total, n_done } => { - let state = if n_done == 0 { - Progress::Begin - } else if n_done < n_total { - Progress::Report - } else { - assert_eq!(n_done, n_total); - self.status = Status::Ready; - became_ready = true; - Progress::End - }; - self.report_progress( - "roots scanned", - state, - Some(format!("{}/{}", n_done, n_total)), - Some(Progress::percentage(n_done, n_total)), - ) + if n_total > 0 { + let state = if n_done == 0 { + Progress::Begin + } else if n_done < n_total { + Progress::Report + } else { + assert_eq!(n_done, n_total); + self.status = Status::Ready; + became_ready = true; + Progress::End + }; + self.report_progress( + "roots scanned", + state, + Some(format!("{}/{}", n_done, n_total)), + Some(Progress::percentage(n_done, n_total)), + ) + } } }, Event::Flycheck(task) => match task { -- cgit v1.2.3