diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index 03f83c7be..5a2905207 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs | |||
@@ -2,7 +2,7 @@ use serde::Deserialize; | |||
2 | use flexi_logger::{Duplicate, Logger}; | 2 | use flexi_logger::{Duplicate, Logger}; |
3 | use gen_lsp_server::{run_server, stdio_transport}; | 3 | use gen_lsp_server::{run_server, stdio_transport}; |
4 | 4 | ||
5 | use ra_lsp_server::Result; | 5 | use ra_lsp_server::{Result, InitializationOptions}; |
6 | 6 | ||
7 | fn main() -> Result<()> { | 7 | fn main() -> Result<()> { |
8 | ::std::env::set_var("RUST_BACKTRACE", "short"); | 8 | ::std::env::set_var("RUST_BACKTRACE", "short"); |
@@ -24,26 +24,18 @@ fn main() -> Result<()> { | |||
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | #[derive(Deserialize)] | ||
28 | #[serde(rename_all = "camelCase")] | ||
29 | struct InitializationOptions { | ||
30 | // Whether the client supports our custom highlighting publishing decorations. | ||
31 | // This is different to the highlightingOn setting, which is whether the user | ||
32 | // wants our custom highlighting to be used. | ||
33 | publish_decorations: Option<bool>, | ||
34 | } | ||
35 | |||
36 | fn main_inner() -> Result<()> { | 27 | fn main_inner() -> Result<()> { |
37 | let (receiver, sender, threads) = stdio_transport(); | 28 | let (receiver, sender, threads) = stdio_transport(); |
38 | let cwd = ::std::env::current_dir()?; | 29 | let cwd = ::std::env::current_dir()?; |
39 | run_server(ra_lsp_server::server_capabilities(), receiver, sender, |params, r, s| { | 30 | run_server(ra_lsp_server::server_capabilities(), receiver, sender, |params, r, s| { |
40 | let root = params.root_uri.and_then(|it| it.to_file_path().ok()).unwrap_or(cwd); | 31 | let root = params.root_uri.and_then(|it| it.to_file_path().ok()).unwrap_or(cwd); |
41 | let supports_decorations = params | 32 | |
33 | let opts = params | ||
42 | .initialization_options | 34 | .initialization_options |
43 | .and_then(|v| InitializationOptions::deserialize(v).ok()) | 35 | .and_then(|v| InitializationOptions::deserialize(v).ok()) |
44 | .and_then(|it| it.publish_decorations) | 36 | .unwrap_or(InitializationOptions::default()); |
45 | == Some(true); | 37 | |
46 | ra_lsp_server::main_loop(false, root, supports_decorations, r, s) | 38 | ra_lsp_server::main_loop(root, opts, r, s) |
47 | })?; | 39 | })?; |
48 | log::info!("shutting down IO..."); | 40 | log::info!("shutting down IO..."); |
49 | threads.join()?; | 41 | threads.join()?; |