Merge #9269
9269: Recreate status page r=lnicola a=Milo123459 I'm working on redesigning the status page. Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
This commit is contained in:
commit
11b9233fc4
@ -12,6 +12,7 @@ use ide_db::{
|
||||
use itertools::Itertools;
|
||||
use profile::{memory_usage, Bytes};
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::env;
|
||||
use stdx::format_to;
|
||||
use syntax::{ast, Parse, SyntaxNode};
|
||||
|
||||
@ -37,12 +38,14 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
|
||||
format_to!(buf, "{}\n", FileTextQuery.in_db(db).entries::<FilesStats>());
|
||||
format_to!(buf, "{}\n", LibrarySymbolsQuery.in_db(db).entries::<LibrarySymbolsStats>());
|
||||
format_to!(buf, "{}\n", syntax_tree_stats(db));
|
||||
format_to!(buf, "{} (macros)\n", macro_syntax_tree_stats(db));
|
||||
format_to!(buf, "{} total\n", memory_usage());
|
||||
format_to!(buf, "\ncounts:\n{}", profile::countme::get_all());
|
||||
format_to!(buf, "{} (Macros)\n", macro_syntax_tree_stats(db));
|
||||
format_to!(buf, "{} in total\n", memory_usage());
|
||||
if env::var("RA_COUNT").is_ok() {
|
||||
format_to!(buf, "\nCounts:\n{}", profile::countme::get_all());
|
||||
}
|
||||
|
||||
if let Some(file_id) = file_id {
|
||||
format_to!(buf, "\nfile info:\n");
|
||||
format_to!(buf, "\nFile info:\n");
|
||||
let krate = crate::parent_module::crate_for(db, file_id).pop();
|
||||
match krate {
|
||||
Some(krate) => {
|
||||
@ -51,19 +54,19 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
|
||||
Some(it) => format!("{}({:?})", it, krate),
|
||||
None => format!("{:?}", krate),
|
||||
};
|
||||
format_to!(buf, "crate: {}\n", display_crate(krate));
|
||||
format_to!(buf, "Crate: {}\n", display_crate(krate));
|
||||
let deps = crate_graph[krate]
|
||||
.dependencies
|
||||
.iter()
|
||||
.map(|dep| format!("{}={:?}", dep.name, dep.crate_id))
|
||||
.format(", ");
|
||||
format_to!(buf, "deps: {}\n", deps);
|
||||
format_to!(buf, "Dependencies: {}\n", deps);
|
||||
}
|
||||
None => format_to!(buf, "does not belong to any crate"),
|
||||
None => format_to!(buf, "Does not belong to any crate"),
|
||||
}
|
||||
}
|
||||
|
||||
buf
|
||||
buf.trim().to_string()
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@ -74,7 +77,7 @@ struct FilesStats {
|
||||
|
||||
impl fmt::Display for FilesStats {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{} ({}) files", self.total, self.size)
|
||||
write!(fmt, "{} of files", self.size)
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +103,7 @@ pub(crate) struct SyntaxTreeStats {
|
||||
|
||||
impl fmt::Display for SyntaxTreeStats {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{} trees, {} retained", self.total, self.retained)
|
||||
write!(fmt, "{} trees, {} preserved", self.total, self.retained)
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +145,7 @@ struct LibrarySymbolsStats {
|
||||
|
||||
impl fmt::Display for LibrarySymbolsStats {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{} ({}) index symbols", self.total, self.size)
|
||||
write!(fmt, "{} of index symbols ({})", self.size, self.total)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] }
|
||||
tracing-tree = { version = "0.1.4" }
|
||||
always-assert = "0.1"
|
||||
|
||||
stdx = { path = "../stdx", version = "0.0.0" }
|
||||
flycheck = { path = "../flycheck", version = "0.0.0" }
|
||||
ide = { path = "../ide", version = "0.0.0" }
|
||||
|
@ -60,21 +60,25 @@ pub(crate) fn handle_analyzer_status(
|
||||
}
|
||||
|
||||
if snap.workspaces.is_empty() {
|
||||
buf.push_str("no workspaces\n")
|
||||
buf.push_str("No workspaces\n")
|
||||
} else {
|
||||
buf.push_str("workspaces:\n");
|
||||
for w in snap.workspaces.iter() {
|
||||
format_to!(buf, "{} packages loaded\n", w.n_packages());
|
||||
}
|
||||
buf.push_str("Workspaces:\n");
|
||||
format_to!(
|
||||
buf,
|
||||
"Loaded {:?} packages across {} workspace{}.\n",
|
||||
snap.workspaces.iter().map(|w| w.n_packages()).sum::<usize>(),
|
||||
snap.workspaces.len(),
|
||||
if snap.workspaces.len() == 1 { "" } else { "s" }
|
||||
);
|
||||
}
|
||||
buf.push_str("\nanalysis:\n");
|
||||
buf.push_str("\nAnalysis:\n");
|
||||
buf.push_str(
|
||||
&snap
|
||||
.analysis
|
||||
.status(file_id)
|
||||
.unwrap_or_else(|_| "Analysis retrieval was cancelled".to_owned()),
|
||||
);
|
||||
format_to!(buf, "\n\nrequests:\n");
|
||||
format_to!(buf, "\n\nRequests:\n");
|
||||
let requests = snap.latest_requests.read();
|
||||
for (is_last, r) in requests.iter() {
|
||||
let mark = if is_last { "*" } else { " " };
|
||||
|
Loading…
x
Reference in New Issue
Block a user