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
This commit is contained in:
DJMcNab 2018-12-21 17:00:31 +00:00
parent 70e5fb98a0
commit 380733d6d0
2 changed files with 11 additions and 8 deletions

View file

@ -27,7 +27,10 @@ fn main() -> Result<()> {
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct InitializationOptions {
highlighting_on: bool,
// Whether the client supports our custom highlighting publishing decorations.
// This is different to the highlightingOn setting, which is whether the client
// wants highlighting to be used or sent.
publish_decorations: Option<bool>,
}
fn main_inner() -> Result<()> {
@ -42,12 +45,12 @@ fn main_inner() -> Result<()> {
.root_uri
.and_then(|it| it.to_file_path().ok())
.unwrap_or(cwd);
let publish_decorations = params
let supports_decorations = params
.initialization_options
.and_then(|v| InitializationOptions::deserialize(v).ok())
.map(|it| it.highlighting_on)
.and_then(|it| it.publish_decorations)
== Some(true);
ra_lsp_server::main_loop(false, root, publish_decorations, r, s)
ra_lsp_server::main_loop(false, root, supports_decorations, r, s)
},
)?;
log::info!("shutting down IO...");