diff --git a/zed-rpc/proto/zed.proto b/zed-rpc/proto/zed.proto index 879c9766cc..d07f639044 100644 --- a/zed-rpc/proto/zed.proto +++ b/zed-rpc/proto/zed.proto @@ -43,7 +43,7 @@ message OpenWorktree { message OpenWorktreeResponse { Worktree worktree = 1; - uint32 replica_id = 2; + optional uint32 replica_id = 2; } message AddGuest { diff --git a/zed/src/workspace.rs b/zed/src/workspace.rs index 04819a09e6..6ae6f43229 100644 --- a/zed/src/workspace.rs +++ b/zed/src/workspace.rs @@ -766,12 +766,21 @@ impl Workspace { let worktree = open_worktree_response .worktree .ok_or_else(|| anyhow!("empty worktree"))?; - let replica_id = open_worktree_response.replica_id as ReplicaId; + let replica_id = open_worktree_response + .replica_id + .ok_or_else(|| anyhow!("empty replica id"))?; let worktree_id = worktree_id.try_into().unwrap(); this.update(&mut cx, |workspace, cx| { let worktree = cx.add_model(|cx| { - Worktree::remote(worktree_id, worktree, rpc, connection_id, replica_id, cx) + Worktree::remote( + worktree_id, + worktree, + rpc, + connection_id, + replica_id as ReplicaId, + cx, + ) }); cx.observe_model(&worktree, |_, _, cx| cx.notify()); workspace.worktrees.insert(worktree);