mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
WIP - Wait for code action anchors to be valid
This commit is contained in:
parent
d358072c74
commit
4e748b188e
2 changed files with 20 additions and 4 deletions
|
@ -216,6 +216,16 @@ impl Global {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl FromIterator<Local> for Global {
|
||||||
|
fn from_iter<T: IntoIterator<Item = Local>>(locals: T) -> Self {
|
||||||
|
let mut result = Self::new();
|
||||||
|
for local in locals {
|
||||||
|
result.observe(local);
|
||||||
|
}
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Ord for Lamport {
|
impl Ord for Lamport {
|
||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
// Use the replica id to break ties between concurrent events.
|
// Use the replica id to break ties between concurrent events.
|
||||||
|
|
|
@ -2395,12 +2395,18 @@ impl Project {
|
||||||
.end
|
.end
|
||||||
.and_then(language::proto::deserialize_anchor)
|
.and_then(language::proto::deserialize_anchor)
|
||||||
.ok_or_else(|| anyhow!("invalid end"))?;
|
.ok_or_else(|| anyhow!("invalid end"))?;
|
||||||
let code_actions = this.update(&mut cx, |this, cx| {
|
let buffer = this.update(&mut cx, |this, _| {
|
||||||
let buffer = this
|
this.shared_buffers
|
||||||
.shared_buffers
|
|
||||||
.get(&sender_id)
|
.get(&sender_id)
|
||||||
.and_then(|shared_buffers| shared_buffers.get(&envelope.payload.buffer_id).cloned())
|
.and_then(|shared_buffers| shared_buffers.get(&envelope.payload.buffer_id).cloned())
|
||||||
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))?;
|
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))
|
||||||
|
})?;
|
||||||
|
buffer
|
||||||
|
.update(&mut cx, |buffer, _| {
|
||||||
|
buffer.wait_for_version([start.timestamp, end.timestamp].into_iter().collect())
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
let code_actions = this.update(&mut cx, |this, cx| {
|
||||||
Ok::<_, anyhow::Error>(this.code_actions(&buffer, start..end, cx))
|
Ok::<_, anyhow::Error>(this.code_actions(&buffer, start..end, cx))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue