aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-18 20:29:20 +0100
committerAleksey Kladov <[email protected]>2019-07-18 20:55:04 +0100
commita6224f36200c768d49b6450204fd95edaa559b50 (patch)
tree0825111965d154a9ad692789dd178e1176a88bc2 /crates/ra_ide_api
parentabe72424a647a31840eb952d42905f83628a623c (diff)
make Parse generic
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs4
-rw-r--r--crates/ra_ide_api/src/status.rs6
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs4
3 files changed, 8 insertions, 6 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..d71c89b43 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, TreeArc};
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 {
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<_>>();