From 2fe41574a1695a6608d738f40ec51bc61fc7604a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Dec 2018 16:19:53 +0300 Subject: fix tests --- crates/ra_analysis/src/imp.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src/imp.rs') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 46169d863..9e441ca79 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -43,10 +43,19 @@ impl AnalysisHostImpl { pub fn apply_change(&mut self, change: AnalysisChange) { log::info!("apply_change {:?}", change); // self.gc_syntax_trees(); - for root_id in change.new_roots { + if !change.new_roots.is_empty() { + let mut local_roots = Vec::clone(&self.db.local_roots()); + for (root_id, is_local) in change.new_roots { + self.db + .query_mut(ra_db::SourceRootQuery) + .set(root_id, Default::default()); + if is_local { + local_roots.push(root_id); + } + } self.db - .query_mut(ra_db::SourceRootQuery) - .set(root_id, Default::default()); + .query_mut(ra_db::LocalRootsQuery) + .set((), Arc::new(local_roots)); } for (root_id, root_change) in change.roots_changed { -- cgit v1.2.3