mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +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,
|
operation: Operation,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) {
|
) {
|
||||||
if let Some((project_id, rpc)) = match self {
|
if let Some((project_id, worktree_id, rpc)) = match self {
|
||||||
Worktree::Local(worktree) => worktree
|
Worktree::Local(worktree) => worktree.share.as_ref().map(|share| {
|
||||||
.share
|
(
|
||||||
.as_ref()
|
share.project_id,
|
||||||
.map(|share| (share.project_id, worktree.client.clone())),
|
worktree.id() as u64,
|
||||||
Worktree::Remote(worktree) => Some((worktree.project_id, worktree.client.clone())),
|
worktree.client.clone(),
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
Worktree::Remote(worktree) => Some((
|
||||||
|
worktree.project_id,
|
||||||
|
worktree.remote_id,
|
||||||
|
worktree.client.clone(),
|
||||||
|
)),
|
||||||
} {
|
} {
|
||||||
cx.spawn(|worktree, mut cx| async move {
|
cx.spawn(|worktree, mut cx| async move {
|
||||||
if let Err(error) = rpc
|
if let Err(error) = rpc
|
||||||
.request(proto::UpdateBuffer {
|
.request(proto::UpdateBuffer {
|
||||||
project_id,
|
project_id,
|
||||||
worktree_id: worktree.id() as u64,
|
worktree_id,
|
||||||
buffer_id,
|
buffer_id,
|
||||||
operations: vec![language::proto::serialize_operation(&operation)],
|
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) {
|
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext) {
|
||||||
let worktree_id = self.worktree.id() as u64;
|
|
||||||
self.worktree.update(cx, |worktree, cx| {
|
self.worktree.update(cx, |worktree, cx| {
|
||||||
if let Worktree::Remote(worktree) = worktree {
|
if let Worktree::Remote(worktree) = worktree {
|
||||||
let project_id = worktree.project_id;
|
let project_id = worktree.project_id;
|
||||||
|
let worktree_id = worktree.remote_id;
|
||||||
let rpc = worktree.client.clone();
|
let rpc = worktree.client.clone();
|
||||||
cx.background()
|
cx.background()
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
|
|
Loading…
Reference in a new issue