mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
show current function in analysis-stats progress bar
This commit is contained in:
parent
c417c77b68
commit
d4b1e958c5
@ -1,4 +1,4 @@
|
||||
use std::{collections::HashSet, time::Instant};
|
||||
use std::{collections::HashSet, time::Instant, fmt::Write};
|
||||
|
||||
use ra_db::SourceDatabase;
|
||||
use ra_batch::BatchDatabase;
|
||||
@ -52,19 +52,24 @@ pub fn run(verbose: bool, path: &str, only: Option<&str>) -> Result<()> {
|
||||
println!("Total declarations: {}", num_decls);
|
||||
println!("Total functions: {}", funcs.len());
|
||||
let bar = indicatif::ProgressBar::new(funcs.len() as u64);
|
||||
bar.set_style(
|
||||
indicatif::ProgressStyle::default_bar().template("{wide_bar} {pos}/{len}\n{msg}"),
|
||||
);
|
||||
bar.tick();
|
||||
let mut num_exprs = 0;
|
||||
let mut num_exprs_unknown = 0;
|
||||
let mut num_exprs_partially_unknown = 0;
|
||||
for f in funcs {
|
||||
let name = f.name(&db);
|
||||
let mut msg = format!("processing: {}", name);
|
||||
if verbose {
|
||||
let (file_id, source) = f.source(&db);
|
||||
let original_file = file_id.original_file(&db);
|
||||
let path = db.file_relative_path(original_file);
|
||||
let syntax_range = source.syntax().range();
|
||||
println!("{} ({:?} {})", name, path, syntax_range);
|
||||
write!(msg, " ({:?} {})", path, syntax_range).unwrap();
|
||||
}
|
||||
bar.set_message(&msg);
|
||||
if let Some(only_name) = only {
|
||||
if name.to_string() != only_name {
|
||||
continue;
|
||||
|
@ -18,7 +18,7 @@ fn main() -> Result<()> {
|
||||
.subcommand(SubCommand::with_name("symbols"))
|
||||
.subcommand(
|
||||
SubCommand::with_name("analysis-stats")
|
||||
.arg(Arg::with_name("verbose").short("v"))
|
||||
.arg(Arg::with_name("verbose").short("v").long("verbose"))
|
||||
.arg(Arg::with_name("only").short("o").takes_value(true))
|
||||
.arg(Arg::with_name("path")),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user