Auto merge of #15636 - 9999years:show-which-roots-are-scanned, r=Veykril

Show which roots are being scanned in progress messages

This changes the `Roots Scanned` message to include the directory being scanned.

Before: `Roots Scanned 206/210 (98%)`
After: `Roots Scanned 206/210: .direnv (98%)`

This makes it a lot easier to tell that `rust-analyzer` isn't crashed, it's just trying to scan a huge directory.

See: #12613
This commit is contained in:
bors 2024-01-16 09:44:56 +00:00
commit c9afd41219
4 changed files with 48 additions and 7 deletions

View file

@ -586,7 +586,7 @@ impl GlobalState {
}
}
}
vfs::loader::Message::Progress { n_total, n_done, config_version } => {
vfs::loader::Message::Progress { n_total, n_done, dir, config_version } => {
always!(config_version <= self.vfs_config_version);
self.vfs_progress_config_version = config_version;
@ -601,10 +601,23 @@ impl GlobalState {
assert_eq!(n_done, n_total);
Progress::End
};
let mut message = format!("{n_done}/{n_total}");
if let Some(dir) = dir {
message += &format!(
": {}",
match dir.strip_prefix(&self.config.root_path()) {
Some(relative_path) => relative_path.as_ref(),
None => dir.as_ref(),
}
.display()
);
}
self.report_progress(
"Roots Scanned",
state,
Some(format!("{n_done}/{n_total}")),
Some(message),
Some(Progress::fraction(n_done, n_total)),
None,
);