aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/status.rs15
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
7use ra_syntax::{AstNode, Parse}; 7use ra_syntax::{TreeArc, SyntaxNode};
8use ra_db::{ 8use ra_db::{
9 ParseQuery, FileTextQuery, SourceRootId, 9 FileTextQuery, SourceRootId,
10 salsa::{Database, debug::{DebugQueryTable, TableEntry}}, 10 salsa::{Database, debug::{DebugQueryTable, TableEntry}},
11}; 11};
12use hir::HirFileId;
12 13
13use crate::{ 14use crate::{
14 FileId, db::RootDatabase, 15 FileId, db::RootDatabase,
@@ -16,7 +17,7 @@ use crate::{
16}; 17};
17 18
18pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { 19pub(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
22pub(crate) fn status(db: &RootDatabase) -> String { 23pub(crate) fn status(db: &RootDatabase) -> String {
@@ -72,17 +73,17 @@ impl fmt::Display for SyntaxTreeStats {
72 } 73 }
73} 74}
74 75
75impl FromIterator<TableEntry<FileId, Parse>> for SyntaxTreeStats { 76impl 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