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.

Don't panic when collaborating with older Zed versions (#7162)

Conrad Irwin689d43047d5d
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs
index f26c4361b7e..d9ea6385cb1 100644
--- a/crates/editor/src/items.rs
+++ b/crates/editor/src/items.rs
@@ -73,18 +73,16 @@ impl FollowableItem for Editor {
.iter()
.map(|excerpt| excerpt.buffer_id)
.collect::<HashSet<_>>();
- let buffers = project
- .update(cx, |project, cx| {
- buffer_ids
- .iter()
- .map(|id| BufferId::new(*id).map(|id| project.open_buffer_by_id(id, cx)))
- .collect::<Result<Vec<_>>>()
- })
- .ok()?;
+ let buffers = project.update(cx, |project, cx| {
+ buffer_ids
+ .iter()
+ .map(|id| BufferId::new(*id).map(|id| project.open_buffer_by_id(id, cx)))
+ .collect::<Result<Vec<_>>>()
+ });
let pane = pane.downgrade();
Some(cx.spawn(|mut cx| async move {
- let mut buffers = futures::future::try_join_all(buffers)
+ let mut buffers = futures::future::try_join_all(buffers?)
.await
.debug_assert_ok("leaders don't share views for unshared buffers")?;
let editor = pane.update(&mut cx, |pane, cx| {
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 093393944b0..177d7384b60 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -2784,8 +2784,10 @@ impl Workspace {
item_tasks.push(task);
leader_view_ids.push(id);
break;
- } else {
- assert!(variant.is_some());
+ } else if variant.is_none() {
+ Err(anyhow!(
+ "failed to construct view from leader (maybe from a different version of zed?)"
+ ))?;
}
}
}