aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-31 18:29:11 +0000
committerDmitry Sharshakov2021-08-31 18:29:11 +0000
commit5b20f6020a4acd74bc545fc27c473f0198354e5d (patch)
treee826e8ec1b9fefd3d9f979e30c6176f4a7302bf2 /helix-lsp
parent6265e196b700b363244961ed2957d9eef5460c34 (diff)
parenta3bd80a6fa4f07b0fa581eae416376763ba94345 (diff)
Merge remote-tracking branch 'origin/master' into debug
Contains type fix on helix-term/src/ui/editor.rs:752:13
Diffstat (limited to 'helix-lsp')
-rw-r--r--helix-lsp/Cargo.toml2
-rw-r--r--helix-lsp/src/transport.rs23
2 files changed, 13 insertions, 12 deletions
diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml
index 63f27cf8..8aecba74 100644
--- a/helix-lsp/Cargo.toml
+++ b/helix-lsp/Cargo.toml
@@ -23,5 +23,5 @@ lsp-types = { version = "0.89", features = ["proposed"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
-tokio = { version = "1.9", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
+tokio = { version = "1.10", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
tokio-stream = "0.1"
diff --git a/helix-lsp/src/transport.rs b/helix-lsp/src/transport.rs
index 5be694c8..67b7b48f 100644
--- a/helix-lsp/src/transport.rs
+++ b/helix-lsp/src/transport.rs
@@ -1,7 +1,7 @@
use crate::Result;
use anyhow::Context;
use jsonrpc_core as jsonrpc;
-use log::{error, info};
+use log::{debug, error, info, warn};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
@@ -83,19 +83,20 @@ impl Transport {
break;
}
- let mut parts = header.split(": ");
+ debug!("<- header {}", header);
- match (parts.next(), parts.next(), parts.next()) {
- (Some("Content-Length"), Some(value), None) => {
+ let parts = header.split_once(": ");
+
+ match parts {
+ Some(("Content-Length", value)) => {
content_length = Some(value.parse().context("invalid content length")?);
}
- (Some(_), Some(_), None) => {}
- _ => {
- return Err(std::io::Error::new(
- std::io::ErrorKind::Other,
- "Failed to parse header",
- )
- .into());
+ Some((_, _)) => {}
+ None => {
+ // Workaround: Some non-conformant language servers will output logging and other garbage
+ // into the same stream as JSON-RPC messages. This can also happen from shell scripts that spawn
+ // the server. Skip such lines and log a warning.
+ warn!("Failed to parse header: {:?}", header);
}
}
}