diff --git a/distant-core/src/client/lsp/msg.rs b/distant-core/src/client/lsp/msg.rs index d6cdc13..2a604c2 100644 --- a/distant-core/src/client/lsp/msg.rs +++ b/distant-core/src/client/lsp/msg.rs @@ -333,24 +333,24 @@ fn swap_prefix(obj: &mut Map, old: &str, new: &str) { } impl LspContent { - /// Converts all URIs with `file://` as the scheme to `distant://` instead + /// Converts all URIs with `file` as the scheme to `distant` instead pub fn convert_local_scheme_to_distant(&mut self) { - self.convert_local_scheme_to("distant://") + self.convert_local_scheme_to("distant") } - /// Converts all URIs with `file://` as the scheme to `scheme` instead + /// Converts all URIs with `file` as the scheme to `scheme` instead pub fn convert_local_scheme_to(&mut self, scheme: &str) { - swap_prefix(&mut self.0, "file://", scheme); + swap_prefix(&mut self.0, "file:", &format!("{scheme}:")); } - /// Converts all URIs with `distant://` as the scheme to `file://` instead + /// Converts all URIs with `distant` as the scheme to `file` instead pub fn convert_distant_scheme_to_local(&mut self) { - self.convert_scheme_to_local("distant://") + self.convert_scheme_to_local("distant") } - /// Converts all URIs with `scheme` as the scheme to `file://` instead + /// Converts all URIs with `scheme` as the scheme to `file` instead pub fn convert_scheme_to_local(&mut self, scheme: &str) { - swap_prefix(&mut self.0, scheme, "file://"); + swap_prefix(&mut self.0, &format!("{scheme}:"), "file:"); } } @@ -719,7 +719,7 @@ mod tests { "key12": true, })); - content.convert_local_scheme_to("custom://"); + content.convert_local_scheme_to("custom"); assert_eq!( content.0, make_obj!({ @@ -809,7 +809,7 @@ mod tests { "key12": true, })); - content.convert_scheme_to_local("custom://"); + content.convert_scheme_to_local("custom"); assert_eq!( content.0, make_obj!({ diff --git a/src/options.rs b/src/options.rs index b1de9cd..b178f20 100644 --- a/src/options.rs +++ b/src/options.rs @@ -418,11 +418,10 @@ pub enum ClientSubcommand { network: NetworkSettings, /// If specified, will assume the remote process is a LSP server - /// and will translate paths that are local into distant:// and vice versa. + /// and will translate paths that are local into `distant` and vice versa. /// /// If a scheme is provided, will translate local paths into that scheme! - /// Note that the scheme must be the exact prefix like `distant://`. - #[clap(long)] + #[clap(long, name = "SCHEME")] lsp: Option>, /// If specified, will spawn process using a pseudo tty