diff options
author | Blaž Hrastnik | 2021-02-15 12:16:25 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-02-16 09:18:35 +0000 |
commit | 48ef6598db8c4f0c93feb1acc4548d013e2e6158 (patch) | |
tree | 17443af119072089b720c4cc73f40b4e3ed62b60 /helix-lsp | |
parent | d8bc19f71519538f712c65810f1657d3f00495f8 (diff) |
Increase the log level in LSP and log server errors.
Diffstat (limited to 'helix-lsp')
-rw-r--r-- | helix-lsp/src/transport.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/helix-lsp/src/transport.rs b/helix-lsp/src/transport.rs index 17566f8e..a14bc1f7 100644 --- a/helix-lsp/src/transport.rs +++ b/helix-lsp/src/transport.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use log::{debug, error}; +use log::{error, info}; use crate::Error; @@ -48,7 +48,6 @@ pub(crate) struct Transport { writer: BufWriter<ChildStdin>, reader: BufReader<ChildStdout>, - #[allow(dead_code)] // TODO: handle stderr logs stderr: BufReader<ChildStderr>, } @@ -111,7 +110,7 @@ impl Transport { // read data - debug!("<- {}", msg); + info!("<- {}", msg); // try parsing as output (server response) or call (server request) let output: serde_json::Result<Message> = serde_json::from_str(&msg); @@ -119,6 +118,16 @@ impl Transport { Ok(output?) } + async fn err( + err: &mut (impl AsyncBufRead + Unpin), + ) -> core::result::Result<(), std::io::Error> { + let mut line = String::new(); + err.read_line(&mut line).await?; + error!("err <- {}", line); + + Ok(()) + } + pub async fn send_payload(&mut self, payload: Payload) -> anyhow::Result<()> { match payload { Payload::Request { chan, value } => { @@ -139,7 +148,7 @@ impl Transport { } pub async fn send(&mut self, request: String) -> anyhow::Result<()> { - debug!("-> {}", request); + info!("-> {}", request); // send the headers self.writer @@ -168,7 +177,7 @@ impl Transport { async fn recv_response(&mut self, output: jsonrpc::Output) -> anyhow::Result<()> { match output { jsonrpc::Output::Success(jsonrpc::Success { id, result, .. }) => { - debug!("<- {}", result); + info!("<- {}", result); let tx = self .pending_requests @@ -210,6 +219,7 @@ impl Transport { self.recv_msg(msg).await.unwrap(); } + _msg = Self::err(&mut self.stderr).fuse() => {} } } } |