mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 19:10:24 +00:00
Error if project is disconnected after getting code actions response
This commit is contained in:
parent
5581674f8f
commit
2a0ddd99d2
1 changed files with 21 additions and 11 deletions
|
@ -3579,7 +3579,7 @@ impl Project {
|
||||||
} else if let Some(project_id) = self.remote_id() {
|
} else if let Some(project_id) = self.remote_id() {
|
||||||
let rpc = self.client.clone();
|
let rpc = self.client.clone();
|
||||||
let version = buffer.version();
|
let version = buffer.version();
|
||||||
cx.spawn_weak(|_, mut cx| async move {
|
cx.spawn_weak(|this, mut cx| async move {
|
||||||
let response = rpc
|
let response = rpc
|
||||||
.request(proto::GetCodeActions {
|
.request(proto::GetCodeActions {
|
||||||
project_id,
|
project_id,
|
||||||
|
@ -3590,6 +3590,15 @@ impl Project {
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if this
|
||||||
|
.upgrade(&cx)
|
||||||
|
.ok_or_else(|| anyhow!("project was dropped"))?
|
||||||
|
.read_with(&cx, |this, _| this.is_read_only())
|
||||||
|
{
|
||||||
|
return Err(anyhow!(
|
||||||
|
"failed to get code actions: project was disconnected"
|
||||||
|
));
|
||||||
|
} else {
|
||||||
buffer_handle
|
buffer_handle
|
||||||
.update(&mut cx, |buffer, _| {
|
.update(&mut cx, |buffer, _| {
|
||||||
buffer.wait_for_version(deserialize_version(response.version))
|
buffer.wait_for_version(deserialize_version(response.version))
|
||||||
|
@ -3601,6 +3610,7 @@ impl Project {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(language::proto::deserialize_code_action)
|
.map(language::proto::deserialize_code_action)
|
||||||
.collect()
|
.collect()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Task::ready(Ok(Default::default()))
|
Task::ready(Ok(Default::default()))
|
||||||
|
|
Loading…
Reference in a new issue