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

This commit is contained in:
Antonio Scandurra 2022-11-28 14:39:27 +01:00
parent b0e1d6bc7f
commit 5581674f8f

View file

@ -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()))