From 5130ee3b5f1701f6173088e487ad354e81f2640f Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Sun, 28 Aug 2022 18:59:02 -0500 Subject: [PATCH] Add missing capabilities() method to DistantChannelExt --- distant-core/src/client/ext.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/distant-core/src/client/ext.rs b/distant-core/src/client/ext.rs index f912982..bd3b447 100644 --- a/distant-core/src/client/ext.rs +++ b/distant-core/src/client/ext.rs @@ -3,8 +3,8 @@ use crate::{ RemoteCommand, RemoteLspCommand, RemoteLspProcess, RemoteOutput, RemoteProcess, Watcher, }, data::{ - ChangeKindSet, DirEntry, DistantRequestData, DistantResponseData, Environment, - Error as Failure, Metadata, PtySize, SystemInfo, + Capabilities, ChangeKindSet, DirEntry, DistantRequestData, DistantResponseData, + Environment, Error as Failure, Metadata, PtySize, SystemInfo, }, DistantMsg, }; @@ -34,6 +34,9 @@ pub trait DistantChannelExt { data: impl Into, ) -> AsyncReturn<'_, ()>; + /// Retrieves server capabilities + fn capabilities(&mut self) -> AsyncReturn<'_, Capabilities>; + /// Copies a remote file or directory from src to dst fn copy(&mut self, src: impl Into, dst: impl Into) -> AsyncReturn<'_, ()>; @@ -185,6 +188,18 @@ impl DistantChannelExt ) } + fn capabilities(&mut self) -> AsyncReturn<'_, Capabilities> { + make_body!( + self, + DistantRequestData::Capabilities {}, + |data| match data { + DistantResponseData::Capabilities { supported } => Ok(supported), + DistantResponseData::Error(x) => Err(io::Error::from(x)), + _ => Err(mismatched_response()), + } + ) + } + fn copy(&mut self, src: impl Into, dst: impl Into) -> AsyncReturn<'_, ()> { make_body!( self,