aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r--crates/ra_lsp_server/src/main.rs20
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 9dc2e3f87..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;
2use flexi_logger::{Duplicate, Logger}; 2use flexi_logger::{Duplicate, Logger};
3use gen_lsp_server::{run_server, stdio_transport}; 3use gen_lsp_server::{run_server, stdio_transport};
4 4
5use ra_lsp_server::Result; 5use ra_lsp_server::{Result, InitializationOptions};
6 6
7fn main() -> Result<()> { 7fn 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")]
29struct 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
36fn main_inner() -> Result<()> { 27fn 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(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()?;