open new buffer (#11203)
Release Notes: - Allow creating new untitled buffers in remote projects TODO: - Add a Test - Fix version number check
This commit is contained in:
parent
28bcc95468
commit
3752ed294d
19 changed files with 276 additions and 111 deletions
|
@ -21,7 +21,7 @@ struct ConnectedPrincipal {
|
|||
connection_ids: HashSet<ConnectionId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Copy, Clone, Debug, Serialize, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ZedVersion(pub SemanticVersion);
|
||||
|
||||
impl fmt::Display for ZedVersion {
|
||||
|
@ -34,6 +34,32 @@ impl ZedVersion {
|
|||
pub fn can_collaborate(&self) -> bool {
|
||||
self.0 >= SemanticVersion::new(0, 129, 2)
|
||||
}
|
||||
|
||||
pub fn with_save_as() -> ZedVersion {
|
||||
ZedVersion(SemanticVersion::new(0, 134, 0))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait VersionedMessage {
|
||||
fn required_host_version(&self) -> Option<ZedVersion> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl VersionedMessage for proto::SaveBuffer {
|
||||
fn required_host_version(&self) -> Option<ZedVersion> {
|
||||
if self.new_path.is_some() {
|
||||
Some(ZedVersion::with_save_as())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl VersionedMessage for proto::OpenNewBuffer {
|
||||
fn required_host_version(&self) -> Option<ZedVersion> {
|
||||
Some(ZedVersion::with_save_as())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
@ -50,6 +76,10 @@ impl ConnectionPool {
|
|||
self.channels.clear();
|
||||
}
|
||||
|
||||
pub fn connection(&mut self, connection_id: ConnectionId) -> Option<&Connection> {
|
||||
self.connections.get(&connection_id)
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
pub fn add_connection(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue