mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 06:05:19 +00:00
Fix accidental usages of local worktree id instead of remote id
This commit is contained in:
parent
55910c0d79
commit
5d8d7de68d
1 changed files with 15 additions and 8 deletions
|
@ -766,18 +766,25 @@ impl Worktree {
|
|||
operation: Operation,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) {
|
||||
if let Some((project_id, rpc)) = match self {
|
||||
Worktree::Local(worktree) => worktree
|
||||
.share
|
||||
.as_ref()
|
||||
.map(|share| (share.project_id, worktree.client.clone())),
|
||||
Worktree::Remote(worktree) => Some((worktree.project_id, worktree.client.clone())),
|
||||
if let Some((project_id, worktree_id, rpc)) = match self {
|
||||
Worktree::Local(worktree) => worktree.share.as_ref().map(|share| {
|
||||
(
|
||||
share.project_id,
|
||||
worktree.id() as u64,
|
||||
worktree.client.clone(),
|
||||
)
|
||||
}),
|
||||
Worktree::Remote(worktree) => Some((
|
||||
worktree.project_id,
|
||||
worktree.remote_id,
|
||||
worktree.client.clone(),
|
||||
)),
|
||||
} {
|
||||
cx.spawn(|worktree, mut cx| async move {
|
||||
if let Err(error) = rpc
|
||||
.request(proto::UpdateBuffer {
|
||||
project_id,
|
||||
worktree_id: worktree.id() as u64,
|
||||
worktree_id,
|
||||
buffer_id,
|
||||
operations: vec![language::proto::serialize_operation(&operation)],
|
||||
})
|
||||
|
@ -1972,10 +1979,10 @@ impl language::File for File {
|
|||
}
|
||||
|
||||
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext) {
|
||||
let worktree_id = self.worktree.id() as u64;
|
||||
self.worktree.update(cx, |worktree, cx| {
|
||||
if let Worktree::Remote(worktree) = worktree {
|
||||
let project_id = worktree.project_id;
|
||||
let worktree_id = worktree.remote_id;
|
||||
let rpc = worktree.client.clone();
|
||||
cx.background()
|
||||
.spawn(async move {
|
||||
|
|
Loading…
Reference in a new issue