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/completion/completion_context.rs4
-rw-r--r--crates/ra_ide_api/src/status.rs12
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs4
3 files changed, 11 insertions, 9 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index f6584cdd6..4aa84751f 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -43,7 +43,7 @@ pub(crate) struct CompletionContext<'a> {
43impl<'a> CompletionContext<'a> { 43impl<'a> CompletionContext<'a> {
44 pub(super) fn new( 44 pub(super) fn new(
45 db: &'a db::RootDatabase, 45 db: &'a db::RootDatabase,
46 original_parse: &'a Parse, 46 original_parse: &'a Parse<ast::SourceFile>,
47 position: FilePosition, 47 position: FilePosition,
48 ) -> Option<CompletionContext<'a>> { 48 ) -> Option<CompletionContext<'a>> {
49 let module = source_binder::module_from_position(db, position); 49 let module = source_binder::module_from_position(db, position);
@@ -83,7 +83,7 @@ impl<'a> CompletionContext<'a> {
83 } 83 }
84 } 84 }
85 85
86 fn fill(&mut self, original_parse: &'a Parse, offset: TextUnit) { 86 fn fill(&mut self, original_parse: &'a Parse<ast::SourceFile>, offset: TextUnit) {
87 // Insert a fake ident to get a valid parse tree. We will use this file 87 // Insert a fake ident to get a valid parse tree. We will use this file
88 // to determine context, though the original_file will be used for 88 // to determine context, though the original_file will be used for
89 // actual completion. 89 // actual completion.
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs
index ce27f5ae2..a31e15245 100644
--- a/crates/ra_ide_api/src/status.rs
+++ b/crates/ra_ide_api/src/status.rs
@@ -9,7 +9,7 @@ use ra_db::{
9 FileTextQuery, SourceRootId, 9 FileTextQuery, SourceRootId,
10}; 10};
11use ra_prof::{memory_usage, Bytes}; 11use ra_prof::{memory_usage, Bytes};
12use ra_syntax::{AstNode, Parse, SyntaxNode, TreeArc}; 12use ra_syntax::{ast, AstNode, Parse, SyntaxNode};
13 13
14use crate::{ 14use crate::{
15 db::RootDatabase, 15 db::RootDatabase,
@@ -79,10 +79,10 @@ impl fmt::Display for SyntaxTreeStats {
79 } 79 }
80} 80}
81 81
82impl FromIterator<TableEntry<FileId, Parse>> for SyntaxTreeStats { 82impl FromIterator<TableEntry<FileId, Parse<ast::SourceFile>>> for SyntaxTreeStats {
83 fn from_iter<T>(iter: T) -> SyntaxTreeStats 83 fn from_iter<T>(iter: T) -> SyntaxTreeStats
84 where 84 where
85 T: IntoIterator<Item = TableEntry<FileId, Parse>>, 85 T: IntoIterator<Item = TableEntry<FileId, Parse<ast::SourceFile>>>,
86 { 86 {
87 let mut res = SyntaxTreeStats::default(); 87 let mut res = SyntaxTreeStats::default();
88 for entry in iter { 88 for entry in iter {
@@ -96,15 +96,15 @@ impl FromIterator<TableEntry<FileId, Parse>> for SyntaxTreeStats {
96 } 96 }
97} 97}
98 98
99impl FromIterator<TableEntry<MacroFile, Option<TreeArc<SyntaxNode>>>> for SyntaxTreeStats { 99impl FromIterator<TableEntry<MacroFile, Option<Parse<SyntaxNode>>>> for SyntaxTreeStats {
100 fn from_iter<T>(iter: T) -> SyntaxTreeStats 100 fn from_iter<T>(iter: T) -> SyntaxTreeStats
101 where 101 where
102 T: IntoIterator<Item = TableEntry<MacroFile, Option<TreeArc<SyntaxNode>>>>, 102 T: IntoIterator<Item = TableEntry<MacroFile, Option<Parse<SyntaxNode>>>>,
103 { 103 {
104 let mut res = SyntaxTreeStats::default(); 104 let mut res = SyntaxTreeStats::default();
105 for entry in iter { 105 for entry in iter {
106 res.total += 1; 106 res.total += 1;
107 if let Some(tree) = entry.value.and_then(|it| it) { 107 if let Some(tree) = entry.value.and_then(|it| it).map(|it| it.tree().to_owned()) {
108 res.retained += 1; 108 res.retained += 1;
109 res.retained_size += tree.memory_size_of_subtree(); 109 res.retained_size += tree.memory_size_of_subtree();
110 } 110 }
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 1f2ba954e..9b3a45319 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -169,7 +169,9 @@ impl SymbolIndex {
169 self.map.as_fst().size() + self.symbols.len() * mem::size_of::<FileSymbol>() 169 self.map.as_fst().size() + self.symbols.len() * mem::size_of::<FileSymbol>()
170 } 170 }
171 171
172 pub(crate) fn for_files(files: impl ParallelIterator<Item = (FileId, Parse)>) -> SymbolIndex { 172 pub(crate) fn for_files(
173 files: impl ParallelIterator<Item = (FileId, Parse<ast::SourceFile>)>,
174 ) -> SymbolIndex {
173 let symbols = files 175 let symbols = files
174 .flat_map(|(file_id, file)| source_file_to_file_symbols(file.tree(), file_id)) 176 .flat_map(|(file_id, file)| source_file_to_file_symbols(file.tree(), file_id))
175 .collect::<Vec<_>>(); 177 .collect::<Vec<_>>();