mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Add missing RPC handlers for local projects
This commit is contained in:
parent
870b73aa36
commit
636931373e
1 changed files with 37 additions and 6 deletions
|
@ -241,13 +241,15 @@ impl Project {
|
||||||
|
|
||||||
self.subscriptions.clear();
|
self.subscriptions.clear();
|
||||||
if let Some(remote_id) = remote_id {
|
if let Some(remote_id) = remote_id {
|
||||||
|
let client = &self.client;
|
||||||
self.subscriptions.extend([
|
self.subscriptions.extend([
|
||||||
self.client
|
client.subscribe_to_entity(remote_id, cx, Self::handle_open_buffer),
|
||||||
.subscribe_to_entity(remote_id, cx, Self::handle_update_worktree),
|
client.subscribe_to_entity(remote_id, cx, Self::handle_close_buffer),
|
||||||
self.client
|
client.subscribe_to_entity(remote_id, cx, Self::handle_add_collaborator),
|
||||||
.subscribe_to_entity(remote_id, cx, Self::handle_update_buffer),
|
client.subscribe_to_entity(remote_id, cx, Self::handle_remove_collaborator),
|
||||||
self.client
|
client.subscribe_to_entity(remote_id, cx, Self::handle_update_worktree),
|
||||||
.subscribe_to_entity(remote_id, cx, Self::handle_buffer_saved),
|
client.subscribe_to_entity(remote_id, cx, Self::handle_update_buffer),
|
||||||
|
client.subscribe_to_entity(remote_id, cx, Self::handle_buffer_saved),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,6 +639,35 @@ impl Project {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn handle_open_buffer(
|
||||||
|
&mut self,
|
||||||
|
envelope: TypedEnvelope<proto::OpenBuffer>,
|
||||||
|
rpc: Arc<Client>,
|
||||||
|
cx: &mut ModelContext<Self>,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
if let Some(worktree) = self.worktree_for_id(envelope.payload.worktree_id as usize) {
|
||||||
|
return worktree.update(cx, |worktree, cx| {
|
||||||
|
worktree.handle_open_buffer(envelope, rpc, cx)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Err(anyhow!("no such worktree"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn handle_close_buffer(
|
||||||
|
&mut self,
|
||||||
|
envelope: TypedEnvelope<proto::CloseBuffer>,
|
||||||
|
rpc: Arc<Client>,
|
||||||
|
cx: &mut ModelContext<Self>,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
if let Some(worktree) = self.worktree_for_id(envelope.payload.worktree_id as usize) {
|
||||||
|
worktree.update(cx, |worktree, cx| {
|
||||||
|
worktree.handle_close_buffer(envelope, rpc, cx)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn handle_buffer_saved(
|
pub fn handle_buffer_saved(
|
||||||
&mut self,
|
&mut self,
|
||||||
envelope: TypedEnvelope<proto::BufferSaved>,
|
envelope: TypedEnvelope<proto::BufferSaved>,
|
||||||
|
|
Loading…
Reference in a new issue