mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
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:
commit
c9afd41219
4 changed files with 48 additions and 7 deletions
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue