Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-lsp/src/transport.rs')
| -rw-r--r-- | helix-lsp/src/transport.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/helix-lsp/src/transport.rs b/helix-lsp/src/transport.rs index fa4966c4..088c617b 100644 --- a/helix-lsp/src/transport.rs +++ b/helix-lsp/src/transport.rs @@ -98,7 +98,7 @@ impl Transport { buffer.clear(); if reader.read_line(buffer).await? == 0 { return Err(Error::StreamClosed); - } + }; // debug!("<- header {:?}", buffer); @@ -133,14 +133,12 @@ impl Transport { info!("{language_server_name} <- {msg}"); - // NOTE: We avoid using `?` here, since it would return early on error - // and skip clearing `content`. By returning the result directly instead, - // we ensure `content.clear()` is always called. - let output = sonic_rs::from_slice(content).map_err(Into::into); + // try parsing as output (server response) or call (server request) + let output: serde_json::Result<ServerMessage> = serde_json::from_str(msg); content.clear(); - output + Ok(output?) } async fn recv_server_error( |