diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index eb4091a3d..82f52a6e8 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs | |||
@@ -40,12 +40,23 @@ fn main_inner() -> Result<()> { | |||
40 | run_server(ra_lsp_server::server_capabilities(), receiver, sender, |params, r, s| { | 40 | run_server(ra_lsp_server::server_capabilities(), receiver, sender, |params, r, s| { |
41 | let root = params.root_uri.and_then(|it| it.to_file_path().ok()).unwrap_or(cwd); | 41 | let root = params.root_uri.and_then(|it| it.to_file_path().ok()).unwrap_or(cwd); |
42 | 42 | ||
43 | let workspace_roots = params | ||
44 | .workspace_folders | ||
45 | .map(|workspaces| { | ||
46 | workspaces | ||
47 | .into_iter() | ||
48 | .filter_map(|it| it.uri.to_file_path().ok()) | ||
49 | .collect::<Vec<_>>() | ||
50 | }) | ||
51 | .filter(|workspaces| !workspaces.is_empty()) | ||
52 | .unwrap_or_else(|| vec![root]); | ||
53 | |||
43 | let opts = params | 54 | let opts = params |
44 | .initialization_options | 55 | .initialization_options |
45 | .and_then(|v| InitializationOptions::deserialize(v).ok()) | 56 | .and_then(|v| InitializationOptions::deserialize(v).ok()) |
46 | .unwrap_or(InitializationOptions::default()); | 57 | .unwrap_or(InitializationOptions::default()); |
47 | 58 | ||
48 | ra_lsp_server::main_loop(root, opts, r, s) | 59 | ra_lsp_server::main_loop(workspace_roots, opts, r, s) |
49 | })?; | 60 | })?; |
50 | log::info!("shutting down IO..."); | 61 | log::info!("shutting down IO..."); |
51 | threads.join()?; | 62 | threads.join()?; |