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 | 11 | ||||
-rw-r--r-- | crates/vfs/src/loader.rs | 8 |
4 files changed, 13 insertions, 22 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 390c66dfc..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_done { | 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..a2f4e0c5b 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 | } |
@@ -199,7 +196,7 @@ impl LoaderActor { | |||
199 | let is_dir = entry.file_type().is_dir(); | 196 | let is_dir = entry.file_type().is_dir(); |
200 | let is_file = entry.file_type().is_file(); | 197 | let is_file = entry.file_type().is_file(); |
201 | let abs_path = AbsPathBuf::try_from(entry.into_path()).unwrap(); | 198 | let abs_path = AbsPathBuf::try_from(entry.into_path()).unwrap(); |
202 | if is_dir { | 199 | if is_dir && watch { |
203 | self.watch(abs_path.clone()); | 200 | self.watch(abs_path.clone()); |
204 | } | 201 | } |
205 | let rel_path = abs_path.strip_prefix(&path)?; | 202 | let rel_path = abs_path.strip_prefix(&path)?; |
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 | } |