aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop.rs')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs31
1 files changed, 17 insertions, 14 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 82410bee3..07ac4917a 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -48,7 +48,7 @@ enum Task {
48const THREADPOOL_SIZE: usize = 8; 48const THREADPOOL_SIZE: usize = 8;
49 49
50pub fn main_loop( 50pub fn main_loop(
51 ws_root: PathBuf, 51 ws_roots: Vec<PathBuf>,
52 options: InitializationOptions, 52 options: InitializationOptions,
53 msg_receiver: &Receiver<RawMessage>, 53 msg_receiver: &Receiver<RawMessage>,
54 msg_sender: &Sender<RawMessage>, 54 msg_sender: &Sender<RawMessage>,
@@ -59,23 +59,26 @@ pub fn main_loop(
59 // FIXME: support dynamic workspace loading. 59 // FIXME: support dynamic workspace loading.
60 let workspaces = { 60 let workspaces = {
61 let ws_worker = workspace_loader(); 61 let ws_worker = workspace_loader();
62 ws_worker.sender().send(ws_root.clone()).unwrap(); 62 let mut loaded_workspaces = Vec::new();
63 match ws_worker.receiver().recv().unwrap() { 63 for ws_root in &ws_roots {
64 Ok(ws) => vec![ws], 64 ws_worker.sender().send(ws_root.clone()).unwrap();
65 Err(e) => { 65 match ws_worker.receiver().recv().unwrap() {
66 log::error!("loading workspace failed: {}", e); 66 Ok(ws) => loaded_workspaces.push(ws),
67 67 Err(e) => {
68 show_message( 68 log::error!("loading workspace failed: {}", e);
69 req::MessageType::Error, 69
70 format!("rust-analyzer failed to load workspace: {}", e), 70 show_message(
71 msg_sender, 71 req::MessageType::Error,
72 ); 72 format!("rust-analyzer failed to load workspace: {}", e),
73 Vec::new() 73 msg_sender,
74 );
75 }
74 } 76 }
75 } 77 }
78 loaded_workspaces
76 }; 79 };
77 80
78 let mut state = ServerWorldState::new(ws_root.clone(), workspaces); 81 let mut state = ServerWorldState::new(ws_roots, workspaces);
79 82
80 log::info!("server initialized, serving requests"); 83 log::info!("server initialized, serving requests");
81 84