From 18486a02fae5966e61f16ea7bc5c33c6c7c69487 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 13 Aug 2018 13:46:05 +0300 Subject: indexing infra --- crates/server/src/main.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'crates/server/src/main.rs') diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index c2952465e..8dca32183 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -13,6 +13,7 @@ extern crate threadpool; extern crate log; extern crate url_serde; extern crate flexi_logger; +extern crate walkdir; extern crate libeditor; extern crate libanalysis; extern crate libsyntax2; @@ -24,6 +25,9 @@ mod dispatch; mod util; mod conv; mod main_loop; +mod vfs; + +use std::path::PathBuf; use threadpool::ThreadPool; use crossbeam_channel::bounded; @@ -114,13 +118,29 @@ fn initialized(io: &mut Io) -> Result<()> { { let mut world = WorldState::new(); let mut pool = ThreadPool::new(4); - let (sender, receiver) = bounded::(16); + let (task_sender, task_receiver) = bounded::(16); + let (fs_events_receiver, watcher) = vfs::watch(vec![ + PathBuf::from("./") + ]); info!("lifecycle: handshake finished, server ready to serve requests"); - let res = main_loop::main_loop(io, &mut world, &mut pool, sender, receiver.clone()); + let res = main_loop::main_loop( + io, + &mut world, + &mut pool, + task_sender, + task_receiver.clone(), + fs_events_receiver, + ); + info!("waiting for background jobs to finish..."); - receiver.for_each(drop); + task_receiver.for_each(drop); pool.join(); info!("...background jobs have finished"); + + info!("waiting for file watcher to finish..."); + watcher.stop()?; + info!("...file watcher has finished"); + res }?; -- cgit v1.2.3