diff options
author | Aleksey Kladov <[email protected]> | 2019-06-01 20:11:38 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-06-01 20:13:24 +0100 |
commit | 37e80c529772aec176d93a33ee5a2fec3ab8e45d (patch) | |
tree | 6bb668dd8184fac575be43ed50d3c49f6021110f | |
parent | ccec71165bf1f8f79bd2d2a5c05bed55ff3a07a2 (diff) |
show macro expanded trees in the stats as well
-rw-r--r-- | crates/ra_ide_api/src/status.rs | 15 |
1 files changed, 8 insertions, 7 deletions
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::{ | |||
4 | sync::Arc, | 4 | sync::Arc, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use ra_syntax::{AstNode, Parse}; | 7 | use ra_syntax::{TreeArc, SyntaxNode}; |
8 | use ra_db::{ | 8 | use ra_db::{ |
9 | ParseQuery, FileTextQuery, SourceRootId, | 9 | FileTextQuery, SourceRootId, |
10 | salsa::{Database, debug::{DebugQueryTable, TableEntry}}, | 10 | salsa::{Database, debug::{DebugQueryTable, TableEntry}}, |
11 | }; | 11 | }; |
12 | use hir::HirFileId; | ||
12 | 13 | ||
13 | use crate::{ | 14 | use crate::{ |
14 | FileId, db::RootDatabase, | 15 | FileId, db::RootDatabase, |
@@ -16,7 +17,7 @@ use crate::{ | |||
16 | }; | 17 | }; |
17 | 18 | ||
18 | pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { | 19 | pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { |
19 | db.query(ParseQuery).entries::<SyntaxTreeStats>() | 20 | db.query(hir::db::ParseOrExpandQuery).entries::<SyntaxTreeStats>() |
20 | } | 21 | } |
21 | 22 | ||
22 | pub(crate) fn status(db: &RootDatabase) -> String { | 23 | pub(crate) fn status(db: &RootDatabase) -> String { |
@@ -72,17 +73,17 @@ impl fmt::Display for SyntaxTreeStats { | |||
72 | } | 73 | } |
73 | } | 74 | } |
74 | 75 | ||
75 | impl FromIterator<TableEntry<FileId, Parse>> for SyntaxTreeStats { | 76 | impl FromIterator<TableEntry<HirFileId, Option<TreeArc<SyntaxNode>>>> for SyntaxTreeStats { |
76 | fn from_iter<T>(iter: T) -> SyntaxTreeStats | 77 | fn from_iter<T>(iter: T) -> SyntaxTreeStats |
77 | where | 78 | where |
78 | T: IntoIterator<Item = TableEntry<FileId, Parse>>, | 79 | T: IntoIterator<Item = TableEntry<HirFileId, Option<TreeArc<SyntaxNode>>>>, |
79 | { | 80 | { |
80 | let mut res = SyntaxTreeStats::default(); | 81 | let mut res = SyntaxTreeStats::default(); |
81 | for entry in iter { | 82 | for entry in iter { |
82 | res.total += 1; | 83 | res.total += 1; |
83 | if let Some(value) = entry.value { | 84 | if let Some(tree) = entry.value.and_then(|it| it) { |
84 | res.retained += 1; | 85 | res.retained += 1; |
85 | res.retained_size += value.tree.syntax().memory_size_of_subtree(); | 86 | res.retained_size += tree.memory_size_of_subtree(); |
86 | } | 87 | } |
87 | } | 88 | } |
88 | res | 89 | res |