diff options
Diffstat (limited to 'crates/server/src/main.rs')
-rw-r--r-- | crates/server/src/main.rs | 26 |
1 files changed, 23 insertions, 3 deletions
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; | |||
13 | extern crate log; | 13 | extern crate log; |
14 | extern crate url_serde; | 14 | extern crate url_serde; |
15 | extern crate flexi_logger; | 15 | extern crate flexi_logger; |
16 | extern crate walkdir; | ||
16 | extern crate libeditor; | 17 | extern crate libeditor; |
17 | extern crate libanalysis; | 18 | extern crate libanalysis; |
18 | extern crate libsyntax2; | 19 | extern crate libsyntax2; |
@@ -24,6 +25,9 @@ mod dispatch; | |||
24 | mod util; | 25 | mod util; |
25 | mod conv; | 26 | mod conv; |
26 | mod main_loop; | 27 | mod main_loop; |
28 | mod vfs; | ||
29 | |||
30 | use std::path::PathBuf; | ||
27 | 31 | ||
28 | use threadpool::ThreadPool; | 32 | use threadpool::ThreadPool; |
29 | use crossbeam_channel::bounded; | 33 | use crossbeam_channel::bounded; |
@@ -114,13 +118,29 @@ fn initialized(io: &mut Io) -> Result<()> { | |||
114 | { | 118 | { |
115 | let mut world = WorldState::new(); | 119 | let mut world = WorldState::new(); |
116 | let mut pool = ThreadPool::new(4); | 120 | let mut pool = ThreadPool::new(4); |
117 | let (sender, receiver) = bounded::<Task>(16); | 121 | let (task_sender, task_receiver) = bounded::<Task>(16); |
122 | let (fs_events_receiver, watcher) = vfs::watch(vec![ | ||
123 | PathBuf::from("./") | ||
124 | ]); | ||
118 | info!("lifecycle: handshake finished, server ready to serve requests"); | 125 | info!("lifecycle: handshake finished, server ready to serve requests"); |
119 | let res = main_loop::main_loop(io, &mut world, &mut pool, sender, receiver.clone()); | 126 | let res = main_loop::main_loop( |
127 | io, | ||
128 | &mut world, | ||
129 | &mut pool, | ||
130 | task_sender, | ||
131 | task_receiver.clone(), | ||
132 | fs_events_receiver, | ||
133 | ); | ||
134 | |||
120 | info!("waiting for background jobs to finish..."); | 135 | info!("waiting for background jobs to finish..."); |
121 | receiver.for_each(drop); | 136 | task_receiver.for_each(drop); |
122 | pool.join(); | 137 | pool.join(); |
123 | info!("...background jobs have finished"); | 138 | info!("...background jobs have finished"); |
139 | |||
140 | info!("waiting for file watcher to finish..."); | ||
141 | watcher.stop()?; | ||
142 | info!("...file watcher has finished"); | ||
143 | |||
124 | res | 144 | res |
125 | }?; | 145 | }?; |
126 | 146 | ||