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.

After completing LSP request, return an error if guest is disconnected

Antonio Scandurra5581674f8f4a
diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs
index 503ae8d4b24..30b0ac25060 100644
--- a/crates/project/src/project.rs
+++ b/crates/project/src/project.rs
@@ -4109,9 +4109,13 @@ impl Project {
let message = request.to_proto(project_id, buffer);
return cx.spawn(|this, cx| async move {
let response = rpc.request(message).await?;
- request
- .response_from_proto(response, this, buffer_handle, cx)
- .await
+ if this.read_with(&cx, |this, _| this.is_read_only()) {
+ Err(anyhow!("disconnected before completing request"))
+ } else {
+ request
+ .response_from_proto(response, this, buffer_handle, cx)
+ .await
+ }
});
}
Task::ready(Ok(Default::default()))