aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main.rs
diff options
context:
space:
mode:
authorDJMcNab <[email protected]>2018-12-21 17:00:31 +0000
committerDJMcNab <[email protected]>2018-12-21 17:00:31 +0000
commit380733d6d0361271620ece87ed970c994fb8b226 (patch)
tree5ce8e1c4b820f06f599ea1b1f53faef0161e842b /crates/ra_lsp_server/src/main.rs
parent70e5fb98a007c49e2f2a1d2f58c31008385c9754 (diff)
Undo the previous mistaken change and make publish_decorations optional
See https://github.com/Microsoft/language-server-protocol/issues/567 for motivations to not require `InitializationOptions` TODO: Check if there are any other protocol extensions which should be disabled if not implemented on the client
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r--crates/ra_lsp_server/src/main.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 4877e4827..038912de0 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -27,7 +27,10 @@ fn main() -> Result<()> {
27#[derive(Deserialize)] 27#[derive(Deserialize)]
28#[serde(rename_all = "camelCase")] 28#[serde(rename_all = "camelCase")]
29struct InitializationOptions { 29struct InitializationOptions {
30 highlighting_on: bool, 30 // Whether the client supports our custom highlighting publishing decorations.
31 // This is different to the highlightingOn setting, which is whether the client
32 // wants highlighting to be used or sent.
33 publish_decorations: Option<bool>,
31} 34}
32 35
33fn main_inner() -> Result<()> { 36fn main_inner() -> Result<()> {
@@ -42,12 +45,12 @@ fn main_inner() -> Result<()> {
42 .root_uri 45 .root_uri
43 .and_then(|it| it.to_file_path().ok()) 46 .and_then(|it| it.to_file_path().ok())
44 .unwrap_or(cwd); 47 .unwrap_or(cwd);
45 let publish_decorations = params 48 let supports_decorations = params
46 .initialization_options 49 .initialization_options
47 .and_then(|v| InitializationOptions::deserialize(v).ok()) 50 .and_then(|v| InitializationOptions::deserialize(v).ok())
48 .map(|it| it.highlighting_on) 51 .and_then(|it| it.publish_decorations)
49 == Some(true); 52 == Some(true);
50 ra_lsp_server::main_loop(false, root, publish_decorations, r, s) 53 ra_lsp_server::main_loop(false, root, supports_decorations, r, s)
51 }, 54 },
52 )?; 55 )?;
53 log::info!("shutting down IO..."); 56 log::info!("shutting down IO...");