Send File protos as part of Buffer protos

Use the File proto to build the File associated with the buffer rather than relying on the local entry.
This commit is contained in:
Nathan Sobo 2022-01-22 22:19:04 -07:00
parent 66fce5ec8e
commit da13d028a3
4 changed files with 92 additions and 54 deletions

View file

@ -189,6 +189,8 @@ pub trait File {
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext);
fn as_any(&self) -> &dyn Any;
fn to_proto(&self) -> rpc::proto::File;
}
pub trait LocalFile: File {
@ -352,6 +354,7 @@ impl Buffer {
pub fn to_proto(&self) -> proto::Buffer {
proto::Buffer {
id: self.remote_id(),
file: self.file.as_ref().map(|f| f.to_proto()),
visible_text: self.text.text(),
deleted_text: self.text.deleted_text(),
undo_map: self