Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Log when failed to deserialize response from language server (#8046)

Thorsten Ballfc101c1fb3d9
diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs
index 93a6d00e99a..478b6501685 100644
--- a/crates/lsp/src/lsp.rs
+++ b/crates/lsp/src/lsp.rs
@@ -891,8 +891,13 @@ impl LanguageServer {
executor
.spawn(async move {
let response = match result {
- Ok(response) => serde_json::from_str(&response)
- .context("failed to deserialize response"),
+ Ok(response) => match serde_json::from_str(&response) {
+ Ok(deserialized) => Ok(deserialized),
+ Err(error) => {
+ log::error!("failed to deserialize response from language server: {}. Response from language server: {:?}", error, response);
+ Err(error).context("failed to deserialize response")
+ }
+ }
Err(error) => Err(anyhow!("{}", error.message)),
};
_ = tx.send(response);