aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src/roots.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-10 10:57:40 +0100
committerAleksey Kladov <[email protected]>2018-09-10 10:57:40 +0100
commit505895a25f98423de07c3cec4793b66a19d098c7 (patch)
tree2df3f41f33b5db0b2bba1e2d2acd08f23fffbc2a /crates/libanalysis/src/roots.rs
parent4f647096665b2ca3725ba1f7415a21fbc46044bb (diff)
store file rsovler
Diffstat (limited to 'crates/libanalysis/src/roots.rs')
-rw-r--r--crates/libanalysis/src/roots.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/libanalysis/src/roots.rs b/crates/libanalysis/src/roots.rs
index 6d1375f88..629a697c5 100644
--- a/crates/libanalysis/src/roots.rs
+++ b/crates/libanalysis/src/roots.rs
@@ -12,6 +12,7 @@ use libsyntax2::File;
12 12
13use { 13use {
14 FileId, 14 FileId,
15 imp::FileResolverImp,
15 module_map::{ModuleMap, ChangeKind}, 16 module_map::{ModuleMap, ChangeKind},
16 symbol_index::SymbolIndex, 17 symbol_index::SymbolIndex,
17}; 18};
@@ -48,6 +49,9 @@ impl WritableSourceRoot {
48 self.file_map.insert(file_id, Arc::new((file_data, Default::default()))); 49 self.file_map.insert(file_id, Arc::new((file_data, Default::default())));
49 } 50 }
50 } 51 }
52 pub fn set_file_resolver(&mut self, file_resolver: FileResolverImp) {
53 self.module_map.set_file_resolver(file_resolver)
54 }
51 pub fn reindex(&self) { 55 pub fn reindex(&self) {
52 let now = Instant::now(); 56 let now = Instant::now();
53 self.file_map 57 self.file_map
@@ -136,8 +140,9 @@ pub(crate) struct ReadonlySourceRoot {
136} 140}
137 141
138impl ReadonlySourceRoot { 142impl ReadonlySourceRoot {
139 pub fn new(files: Vec<(FileId, String)>) -> ReadonlySourceRoot { 143 pub(crate) fn new(files: Vec<(FileId, String)>, file_resolver: FileResolverImp) -> ReadonlySourceRoot {
140 let mut module_map = ModuleMap::new(); 144 let mut module_map = ModuleMap::new();
145 module_map.set_file_resolver(file_resolver);
141 let symbol_index = SymbolIndex::for_files( 146 let symbol_index = SymbolIndex::for_files(
142 files.par_iter().map(|(file_id, text)| { 147 files.par_iter().map(|(file_id, text)| {
143 (*file_id, File::parse(text)) 148 (*file_id, File::parse(text))