diff options
Diffstat (limited to 'crates/libanalysis/src/symbol_index.rs')
-rw-r--r-- | crates/libanalysis/src/symbol_index.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/libanalysis/src/symbol_index.rs b/crates/libanalysis/src/symbol_index.rs index 4c93761aa..d22187ac0 100644 --- a/crates/libanalysis/src/symbol_index.rs +++ b/crates/libanalysis/src/symbol_index.rs | |||
@@ -1,3 +1,7 @@ | |||
1 | use std::{ | ||
2 | sync::Arc, | ||
3 | hash::{Hash, Hasher}, | ||
4 | }; | ||
1 | use libeditor::{FileSymbol, file_symbols}; | 5 | use libeditor::{FileSymbol, file_symbols}; |
2 | use libsyntax2::{ | 6 | use libsyntax2::{ |
3 | File, | 7 | File, |
@@ -13,6 +17,12 @@ pub(crate) struct SymbolIndex { | |||
13 | map: fst::Map, | 17 | map: fst::Map, |
14 | } | 18 | } |
15 | 19 | ||
20 | impl Hash for SymbolIndex { | ||
21 | fn hash<H: Hasher>(&self, hasher: &mut H) { | ||
22 | self.symbols.hash(hasher) | ||
23 | } | ||
24 | } | ||
25 | |||
16 | impl SymbolIndex { | 26 | impl SymbolIndex { |
17 | pub(crate) fn for_files(files: impl ParallelIterator<Item=(FileId, File)>) -> SymbolIndex { | 27 | pub(crate) fn for_files(files: impl ParallelIterator<Item=(FileId, File)>) -> SymbolIndex { |
18 | let mut symbols = files | 28 | let mut symbols = files |
@@ -43,7 +53,7 @@ impl SymbolIndex { | |||
43 | impl Query { | 53 | impl Query { |
44 | pub(crate) fn search( | 54 | pub(crate) fn search( |
45 | self, | 55 | self, |
46 | indices: &[&SymbolIndex], | 56 | indices: &[Arc<SymbolIndex>], |
47 | token: &JobToken, | 57 | token: &JobToken, |
48 | ) -> Vec<(FileId, FileSymbol)> { | 58 | ) -> Vec<(FileId, FileSymbol)> { |
49 | 59 | ||