302: WIP: Support tracing lsp requests. r=DJMcNab a=DJMcNab

EDIT: We need to work out a better way to handle settings before this can be merged. Help wanted

TODO: Debug why decorations are sent even when highlightingOn is disabled
This makes the log volume so high its impossible to work with anyway.
(Continuation of #84 [#99 only disabled using it, not making sure we don't send it]).

These logs can be used in https://microsoft.github.io/language-server-protocol/inspector/

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
This commit is contained in:
bors[bot] 2018-12-24 13:47:27 +00:00
commit b052059f86
4 changed files with 47 additions and 9 deletions

View file

@ -27,7 +27,10 @@ fn main() -> Result<()> {
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct InitializationOptions {
publish_decorations: bool,
// Whether the client supports our custom highlighting publishing decorations.
// This is different to the highlightingOn setting, which is whether the user
// wants our custom highlighting to be used.
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.publish_decorations)
.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...");