diff options
Diffstat (limited to 'crates/ra_ide_api/src/symbol_index.rs')
-rw-r--r-- | crates/ra_ide_api/src/symbol_index.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index f4a0c6ac7..1f2ba954e 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs | |||
@@ -34,9 +34,9 @@ use ra_db::{ | |||
34 | use ra_syntax::{ | 34 | use ra_syntax::{ |
35 | algo::visit::{visitor, Visitor}, | 35 | algo::visit::{visitor, Visitor}, |
36 | ast::{self, NameOwner}, | 36 | ast::{self, NameOwner}, |
37 | AstNode, SmolStr, SourceFile, | 37 | AstNode, Parse, SmolStr, SourceFile, |
38 | SyntaxKind::{self, *}, | 38 | SyntaxKind::{self, *}, |
39 | SyntaxNode, SyntaxNodePtr, TextRange, TreeArc, WalkEvent, | 39 | SyntaxNode, SyntaxNodePtr, TextRange, WalkEvent, |
40 | }; | 40 | }; |
41 | use rayon::prelude::*; | 41 | use rayon::prelude::*; |
42 | 42 | ||
@@ -59,9 +59,9 @@ pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { | |||
59 | 59 | ||
60 | fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { | 60 | fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { |
61 | db.check_canceled(); | 61 | db.check_canceled(); |
62 | let source_file = db.parse(file_id).tree; | 62 | let parse = db.parse(file_id); |
63 | 63 | ||
64 | let symbols = source_file_to_file_symbols(&source_file, file_id); | 64 | let symbols = source_file_to_file_symbols(parse.tree(), file_id); |
65 | 65 | ||
66 | // FIXME: add macros here | 66 | // FIXME: add macros here |
67 | 67 | ||
@@ -169,11 +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( | 172 | pub(crate) fn for_files(files: impl ParallelIterator<Item = (FileId, Parse)>) -> SymbolIndex { |
173 | files: impl ParallelIterator<Item = (FileId, TreeArc<SourceFile>)>, | ||
174 | ) -> SymbolIndex { | ||
175 | let symbols = files | 173 | let symbols = files |
176 | .flat_map(|(file_id, file)| source_file_to_file_symbols(&file, file_id)) | 174 | .flat_map(|(file_id, file)| source_file_to_file_symbols(file.tree(), file_id)) |
177 | .collect::<Vec<_>>(); | 175 | .collect::<Vec<_>>(); |
178 | SymbolIndex::new(symbols) | 176 | SymbolIndex::new(symbols) |
179 | } | 177 | } |