From 37e80c529772aec176d93a33ee5a2fec3ab8e45d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Jun 2019 22:11:38 +0300 Subject: show macro expanded trees in the stats as well --- crates/ra_ide_api/src/status.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'crates/ra_ide_api/src/status.rs') diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index 821106fea..822279812 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs @@ -4,11 +4,12 @@ use std::{ sync::Arc, }; -use ra_syntax::{AstNode, Parse}; +use ra_syntax::{TreeArc, SyntaxNode}; use ra_db::{ - ParseQuery, FileTextQuery, SourceRootId, + FileTextQuery, SourceRootId, salsa::{Database, debug::{DebugQueryTable, TableEntry}}, }; +use hir::HirFileId; use crate::{ FileId, db::RootDatabase, @@ -16,7 +17,7 @@ use crate::{ }; pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { - db.query(ParseQuery).entries::() + db.query(hir::db::ParseOrExpandQuery).entries::() } pub(crate) fn status(db: &RootDatabase) -> String { @@ -72,17 +73,17 @@ impl fmt::Display for SyntaxTreeStats { } } -impl FromIterator> for SyntaxTreeStats { +impl FromIterator>>> for SyntaxTreeStats { fn from_iter(iter: T) -> SyntaxTreeStats where - T: IntoIterator>, + T: IntoIterator>>>, { let mut res = SyntaxTreeStats::default(); for entry in iter { res.total += 1; - if let Some(value) = entry.value { + if let Some(tree) = entry.value.and_then(|it| it) { res.retained += 1; - res.retained_size += value.tree.syntax().memory_size_of_subtree(); + res.retained_size += tree.memory_size_of_subtree(); } } res -- cgit v1.2.3