From 5581674f8f4a8b256d986f20e0ddb4c1d84bc0af Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 28 Nov 2022 14:39:27 +0100 Subject: [PATCH] After completing LSP request, return an error if guest is disconnected --- crates/project/src/project.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 503ae8d4b2..30b0ac2506 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()))