mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 15:44:31 +03:00
Add missing RPC handlers for local projects
This commit is contained in:
parent
870b73aa36
commit
636931373e
@ -241,13 +241,15 @@ impl Project {
|
||||
|
||||
self.subscriptions.clear();
|
||||
if let Some(remote_id) = remote_id {
|
||||
let client = &self.client;
|
||||
self.subscriptions.extend([
|
||||
self.client
|
||||
.subscribe_to_entity(remote_id, cx, Self::handle_update_worktree),
|
||||
self.client
|
||||
.subscribe_to_entity(remote_id, cx, Self::handle_update_buffer),
|
||||
self.client
|
||||
.subscribe_to_entity(remote_id, cx, Self::handle_buffer_saved),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_open_buffer),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_close_buffer),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_add_collaborator),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_remove_collaborator),
|
||||
client.subscribe_to_entity(remote_id, cx, Self::handle_update_worktree),
|
||||
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(())
|
||||
}
|
||||
|
||||
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(
|
||||
&mut self,
|
||||
envelope: TypedEnvelope<proto::BufferSaved>,
|
||||
|
Loading…
Reference in New Issue
Block a user