From f6adb85b681c23b64cc33197eb67d5d7fcf920f0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 19:11:58 +0300 Subject: add gc request --- crates/ra_ide_api/src/imp.rs | 5 +++-- crates/ra_ide_api/src/lib.rs | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs index 8ecb8b17c..961f7b230 100644 --- a/crates/ra_ide_api/src/imp.rs +++ b/crates/ra_ide_api/src/imp.rs @@ -72,13 +72,14 @@ impl db::RootDatabase { self.set_source_root(root_id, Arc::new(source_root)); } - #[allow(unused)] /// Ideally, we should call this function from time to time to collect heavy /// syntax trees. However, if we actually do that, everything is recomputed /// for some reason. Needs investigation. - fn gc_syntax_trees(&mut self) { + pub(crate) fn collect_garbage(&mut self) { self.query(ra_db::SourceFileQuery) .sweep(salsa::SweepStrategy::default().discard_values()); + self.query(hir::db::HirSourceFileQuery) + .sweep(salsa::SweepStrategy::default().discard_values()); self.query(hir::db::FileItemsQuery) .sweep(salsa::SweepStrategy::default().discard_values()); self.query(hir::db::FileItemQuery) diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 3502bfd2e..ffd026b04 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -285,6 +285,10 @@ impl AnalysisHost { pub fn apply_change(&mut self, change: AnalysisChange) { self.db.apply_change(change) } + + pub fn collect_garbage(&mut self) { + self.db.collect_garbage(); + } } /// Analysis is a snapshot of a world state at a moment in time. It is the main -- cgit v1.2.3