From ee932d464b2c15b9c130e734a01fc50e5a18d106 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 25 Aug 2019 13:04:56 +0300 Subject: :arrow_up: vfs --- crates/ra_batch/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'crates/ra_batch/src') diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs index f458ea300..4e5bad044 100644 --- a/crates/ra_batch/src/lib.rs +++ b/crates/ra_batch/src/lib.rs @@ -2,10 +2,11 @@ use std::{collections::HashSet, error::Error, path::Path}; use rustc_hash::FxHashMap; +use crossbeam_channel::{unbounded, Receiver}; use ra_db::{CrateGraph, FileId, SourceRootId}; use ra_ide_api::{AnalysisChange, AnalysisHost, FeatureFlags}; use ra_project_model::{PackageRoot, ProjectWorkspace}; -use ra_vfs::{RootEntry, Vfs, VfsChange}; +use ra_vfs::{RootEntry, Vfs, VfsChange, VfsTask}; use ra_vfs_glob::RustPackageFilterBuilder; type Result = std::result::Result>; @@ -21,6 +22,8 @@ pub fn load_cargo(root: &Path) -> Result<(AnalysisHost, FxHashMap Result<(AnalysisHost, FxHashMap Result<(AnalysisHost, FxHashMap>(); - let host = load(&source_roots, crate_graph, &mut vfs); + let host = load(&source_roots, crate_graph, &mut vfs, receiver); Ok((host, source_roots)) } @@ -61,6 +65,7 @@ pub fn load( source_roots: &FxHashMap, crate_graph: CrateGraph, vfs: &mut Vfs, + receiver: Receiver, ) -> AnalysisHost { let lru_cap = std::env::var("RA_LRU_CAP").ok().and_then(|it| it.parse::().ok()); let mut host = AnalysisHost::new(lru_cap, FeatureFlags::default()); @@ -68,7 +73,6 @@ pub fn load( analysis_change.set_crate_graph(crate_graph); // wait until Vfs has loaded all roots - let receiver = vfs.task_receiver().clone(); let mut roots_loaded = HashSet::new(); for task in receiver { vfs.handle_task(task); -- cgit v1.2.3