Remove unused CloseBuffer message

This commit is contained in:
Antonio Scandurra 2022-03-08 11:17:20 +01:00
parent d6c8fdb3c4
commit 51d5ed48f0
6 changed files with 0 additions and 47 deletions

View file

@ -201,8 +201,6 @@ pub trait File {
cx: &mut MutableAppContext,
) -> Task<Result<(clock::Global, SystemTime)>>;
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext);
fn as_any(&self) -> &dyn Any;
fn to_proto(&self) -> rpc::proto::File;
@ -273,8 +271,6 @@ impl File for FakeFile {
cx.spawn(|_| async move { Ok((Default::default(), SystemTime::UNIX_EPOCH)) })
}
fn buffer_removed(&self, _: u64, _: &mut MutableAppContext) {}
fn as_any(&self) -> &dyn Any {
self
}
@ -1870,7 +1866,6 @@ impl Entity for Buffer {
fn release(&mut self, cx: &mut gpui::MutableAppContext) {
if let Some(file) = self.file.as_ref() {
file.buffer_removed(self.remote_id(), cx);
if let Some((lang_server, file)) = self.language_server.as_ref().zip(file.as_local()) {
let request = lang_server
.server

View file

@ -201,7 +201,6 @@ impl Project {
client.add_entity_message_handler(Self::handle_add_collaborator);
client.add_entity_message_handler(Self::handle_buffer_reloaded);
client.add_entity_message_handler(Self::handle_buffer_saved);
client.add_entity_message_handler(Self::handle_close_buffer);
client.add_entity_message_handler(Self::handle_disk_based_diagnostics_updated);
client.add_entity_message_handler(Self::handle_disk_based_diagnostics_updating);
client.add_entity_message_handler(Self::handle_remove_collaborator);
@ -3456,16 +3455,6 @@ impl Project {
})
}
async fn handle_close_buffer(
_: ModelHandle<Self>,
_: TypedEnvelope<proto::CloseBuffer>,
_: Arc<Client>,
_: AsyncAppContext,
) -> Result<()> {
// TODO: use this for following
Ok(())
}
async fn handle_buffer_saved(
this: ModelHandle<Self>,
envelope: TypedEnvelope<proto::BufferSaved>,

View file

@ -1415,20 +1415,6 @@ impl language::File for File {
})
}
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext) {
self.worktree.update(cx, |worktree, _| {
if let Worktree::Remote(worktree) = worktree {
worktree
.client
.send(proto::CloseBuffer {
project_id: worktree.project_id,
buffer_id,
})
.log_err();
}
});
}
fn as_any(&self) -> &dyn Any {
self
}

View file

@ -42,7 +42,6 @@ message Envelope {
OpenBuffer open_buffer = 35;
OpenBufferResponse open_buffer_response = 36;
CloseBuffer close_buffer = 37;
UpdateBuffer update_buffer = 38;
UpdateBufferFile update_buffer_file = 39;
SaveBuffer save_buffer = 40;

View file

@ -146,7 +146,6 @@ messages!(
(BufferReloaded, Foreground),
(BufferSaved, Foreground),
(ChannelMessageSent, Foreground),
(CloseBuffer, Foreground),
(DiskBasedDiagnosticsUpdated, Background),
(DiskBasedDiagnosticsUpdating, Background),
(Error, Foreground),
@ -247,7 +246,6 @@ entity_messages!(
ApplyCompletionAdditionalEdits,
BufferReloaded,
BufferSaved,
CloseBuffer,
DiskBasedDiagnosticsUpdated,
DiskBasedDiagnosticsUpdating,
FormatBuffers,

View file

@ -102,7 +102,6 @@ impl Server {
.add_request_handler(Server::forward_project_request::<proto::PrepareRename>)
.add_request_handler(Server::forward_project_request::<proto::PerformRename>)
.add_request_handler(Server::forward_project_request::<proto::FormatBuffers>)
.add_message_handler(Server::close_buffer)
.add_request_handler(Server::update_buffer)
.add_message_handler(Server::update_buffer_file)
.add_message_handler(Server::buffer_reloaded)
@ -581,19 +580,6 @@ impl Server {
.await?)
}
async fn close_buffer(
self: Arc<Server>,
request: TypedEnvelope<proto::CloseBuffer>,
) -> tide::Result<()> {
let host_connection_id = self
.state()
.read_project(request.payload.project_id, request.sender_id)?
.host_connection_id;
self.peer
.forward_send(request.sender_id, host_connection_id, request.payload)?;
Ok(())
}
async fn save_buffer(
self: Arc<Server>,
request: TypedEnvelope<proto::SaveBuffer>,