diff options
-rw-r--r-- | crates/rust-analyzer/src/cli/load_cargo.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 12 | ||||
-rw-r--r-- | crates/vfs-notify/src/lib.rs | 9 | ||||
-rw-r--r-- | crates/vfs/src/loader.rs | 8 |
4 files changed, 12 insertions, 21 deletions
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 9c510bb62..92e9b60fc 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -67,8 +67,8 @@ pub(crate) fn load( | |||
67 | // wait until Vfs has loaded all roots | 67 | // wait until Vfs has loaded all roots |
68 | for task in receiver { | 68 | for task in receiver { |
69 | match task { | 69 | match task { |
70 | vfs::loader::Message::Progress { n_entries_done, n_entries_total } => { | 70 | vfs::loader::Message::Progress { n_done, n_total } => { |
71 | if n_entries_done == n_entries_total { | 71 | if n_done == n_total { |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | } | 74 | } |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 755fd23b3..b55d45cd3 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -305,18 +305,12 @@ fn loop_turn( | |||
305 | } | 305 | } |
306 | } | 306 | } |
307 | } | 307 | } |
308 | vfs::loader::Message::Progress { n_entries_total, n_entries_done } => { | 308 | vfs::loader::Message::Progress { n_total, n_done } => { |
309 | if n_entries_done == n_entries_total { | 309 | if n_done == n_total { |
310 | loop_state.status = Status::Ready; | 310 | loop_state.status = Status::Ready; |
311 | became_ready = true; | 311 | became_ready = true; |
312 | } | 312 | } |
313 | report_progress( | 313 | report_progress(loop_state, &connection.sender, n_done, n_total, "roots scanned") |
314 | loop_state, | ||
315 | &connection.sender, | ||
316 | n_entries_done, | ||
317 | n_entries_total, | ||
318 | "roots scanned", | ||
319 | ) | ||
320 | } | 314 | } |
321 | }, | 315 | }, |
322 | Event::CheckWatcher(task) => on_check_task(task, global_state, task_sender)?, | 316 | Event::CheckWatcher(task) => on_check_task(task, global_state, task_sender)?, |
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs index 5b4978285..b3d7c414c 100644 --- a/crates/vfs-notify/src/lib.rs +++ b/crates/vfs-notify/src/lib.rs | |||
@@ -89,8 +89,8 @@ impl LoaderActor { | |||
89 | match event { | 89 | match event { |
90 | Event::Message(msg) => match msg { | 90 | Event::Message(msg) => match msg { |
91 | Message::Config(config) => { | 91 | Message::Config(config) => { |
92 | let n_entries_total = config.load.len(); | 92 | let n_total = config.load.len(); |
93 | self.send(loader::Message::Progress { n_entries_total, n_entries_done: 0 }); | 93 | self.send(loader::Message::Progress { n_total, n_done: 0 }); |
94 | 94 | ||
95 | self.unwatch_all(); | 95 | self.unwatch_all(); |
96 | self.config.clear(); | 96 | self.config.clear(); |
@@ -99,10 +99,7 @@ impl LoaderActor { | |||
99 | let watch = config.watch.contains(&i); | 99 | let watch = config.watch.contains(&i); |
100 | let files = self.load_entry(entry, watch); | 100 | let files = self.load_entry(entry, watch); |
101 | self.send(loader::Message::Loaded { files }); | 101 | self.send(loader::Message::Loaded { files }); |
102 | self.send(loader::Message::Progress { | 102 | self.send(loader::Message::Progress { n_total, n_done: i + 1 }); |
103 | n_entries_total, | ||
104 | n_entries_done: i + 1, | ||
105 | }); | ||
106 | } | 103 | } |
107 | self.config.sort_by(|x, y| x.0.cmp(&y.0)); | 104 | self.config.sort_by(|x, y| x.0.cmp(&y.0)); |
108 | } | 105 | } |
diff --git a/crates/vfs/src/loader.rs b/crates/vfs/src/loader.rs index 052803dd9..6de2e5b3f 100644 --- a/crates/vfs/src/loader.rs +++ b/crates/vfs/src/loader.rs | |||
@@ -16,7 +16,7 @@ pub struct Config { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | pub enum Message { | 18 | pub enum Message { |
19 | Progress { n_entries_total: usize, n_entries_done: usize }, | 19 | Progress { n_total: usize, n_done: usize }, |
20 | Loaded { files: Vec<(AbsPathBuf, Option<Vec<u8>>)> }, | 20 | Loaded { files: Vec<(AbsPathBuf, Option<Vec<u8>>)> }, |
21 | } | 21 | } |
22 | 22 | ||
@@ -56,10 +56,10 @@ impl fmt::Debug for Message { | |||
56 | Message::Loaded { files } => { | 56 | Message::Loaded { files } => { |
57 | f.debug_struct("Loaded").field("n_files", &files.len()).finish() | 57 | f.debug_struct("Loaded").field("n_files", &files.len()).finish() |
58 | } | 58 | } |
59 | Message::Progress { n_entries_total, n_entries_done } => f | 59 | Message::Progress { n_total, n_done } => f |
60 | .debug_struct("Progress") | 60 | .debug_struct("Progress") |
61 | .field("n_entries_total", n_entries_total) | 61 | .field("n_total", n_total) |
62 | .field("n_entries_done", n_entries_done) | 62 | .field("n_done", n_done) |
63 | .finish(), | 63 | .finish(), |
64 | } | 64 | } |
65 | } | 65 | } |