diff options
Diffstat (limited to 'crates/ra_ide_api/src/change.rs')
-rw-r--r-- | crates/ra_ide_api/src/change.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 0d52f5ffb..cc476a237 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs | |||
@@ -6,6 +6,7 @@ use ra_db::{ | |||
6 | }; | 6 | }; |
7 | use ra_prof::{memory_usage, profile, Bytes}; | 7 | use ra_prof::{memory_usage, profile, Bytes}; |
8 | use ra_syntax::SourceFile; | 8 | use ra_syntax::SourceFile; |
9 | #[cfg(not(feature = "wasm"))] | ||
9 | use rayon::prelude::*; | 10 | use rayon::prelude::*; |
10 | use relative_path::RelativePathBuf; | 11 | use relative_path::RelativePathBuf; |
11 | use rustc_hash::FxHashMap; | 12 | use rustc_hash::FxHashMap; |
@@ -143,7 +144,12 @@ impl LibraryData { | |||
143 | root_id: SourceRootId, | 144 | root_id: SourceRootId, |
144 | files: Vec<(FileId, RelativePathBuf, Arc<String>)>, | 145 | files: Vec<(FileId, RelativePathBuf, Arc<String>)>, |
145 | ) -> LibraryData { | 146 | ) -> LibraryData { |
146 | let symbol_index = SymbolIndex::for_files(files.par_iter().map(|(file_id, _, text)| { | 147 | #[cfg(not(feature = "wasm"))] |
148 | let iter = files.par_iter(); | ||
149 | #[cfg(feature = "wasm")] | ||
150 | let iter = files.iter(); | ||
151 | |||
152 | let symbol_index = SymbolIndex::for_files(iter.map(|(file_id, _, text)| { | ||
147 | let parse = SourceFile::parse(text); | 153 | let parse = SourceFile::parse(text); |
148 | (*file_id, parse) | 154 | (*file_id, parse) |
149 | })); | 155 | })); |
@@ -234,8 +240,12 @@ impl RootDatabase { | |||
234 | } | 240 | } |
235 | 241 | ||
236 | pub(crate) fn maybe_collect_garbage(&mut self) { | 242 | pub(crate) fn maybe_collect_garbage(&mut self) { |
243 | if cfg!(feature = "wasm") { | ||
244 | return; | ||
245 | } | ||
246 | |||
237 | if self.last_gc_check.elapsed() > GC_COOLDOWN { | 247 | if self.last_gc_check.elapsed() > GC_COOLDOWN { |
238 | self.last_gc_check = time::Instant::now(); | 248 | self.last_gc_check = crate::wasm_shims::Instant::now(); |
239 | let retained_trees = syntax_tree_stats(self).retained; | 249 | let retained_trees = syntax_tree_stats(self).retained; |
240 | if retained_trees > 100 { | 250 | if retained_trees > 100 { |
241 | log::info!("automatic garbadge collection, {} retained trees", retained_trees); | 251 | log::info!("automatic garbadge collection, {} retained trees", retained_trees); |
@@ -245,8 +255,12 @@ impl RootDatabase { | |||
245 | } | 255 | } |
246 | 256 | ||
247 | pub(crate) fn collect_garbage(&mut self) { | 257 | pub(crate) fn collect_garbage(&mut self) { |
258 | if cfg!(feature = "wasm") { | ||
259 | return; | ||
260 | } | ||
261 | |||
248 | let _p = profile("RootDatabase::collect_garbage"); | 262 | let _p = profile("RootDatabase::collect_garbage"); |
249 | self.last_gc = time::Instant::now(); | 263 | self.last_gc = crate::wasm_shims::Instant::now(); |
250 | 264 | ||
251 | let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); | 265 | let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); |
252 | 266 | ||