Restructure remote client crate, consolidate SSH logic (#36967)

This is a pure refactor that consolidates all SSH remoting logic such
that it should be straightforward to add another transport to the
remoting system.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Max Brunsfeld
2025-08-27 00:15:39 +00:00
committed by GitHub
co-authored by Mikayla Maki
parent d713390366
commit 1eae76e856
39 changed files with 3330 additions and 3411 deletions
@@ -64,8 +64,8 @@ impl DisconnectedOverlay {
}
let handle = cx.entity().downgrade();
let ssh_connection_options = project.read(cx).ssh_connection_options(cx);
let host = if let Some(ssh_connection_options) = ssh_connection_options {
let remote_connection_options = project.read(cx).remote_connection_options(cx);
let host = if let Some(ssh_connection_options) = remote_connection_options {
Host::SshRemoteProject(ssh_connection_options)
} else {
Host::RemoteProject
+4 -4
View File
@@ -28,8 +28,8 @@ use paths::user_ssh_config_file;
use picker::Picker;
use project::Fs;
use project::Project;
use remote::ssh_session::ConnectionIdentifier;
use remote::{SshConnectionOptions, SshRemoteClient};
use remote::remote_client::ConnectionIdentifier;
use remote::{RemoteClient, SshConnectionOptions};
use settings::Settings;
use settings::SettingsStore;
use settings::update_settings_file;
@@ -69,7 +69,7 @@ pub struct RemoteServerProjects {
mode: Mode,
focus_handle: FocusHandle,
workspace: WeakEntity<Workspace>,
retained_connections: Vec<Entity<SshRemoteClient>>,
retained_connections: Vec<Entity<RemoteClient>>,
ssh_config_updates: Task<()>,
ssh_config_servers: BTreeSet<SharedString>,
create_new_window: bool,
@@ -597,7 +597,7 @@ impl RemoteServerProjects {
let (path_style, project) = cx.update(|_, cx| {
(
session.read(cx).path_style(),
project::Project::ssh(
project::Project::remote(
session,
app_state.client.clone(),
app_state.node_runtime.clone(),
+10 -9
View File
@@ -15,8 +15,9 @@ use gpui::{
use language::CursorShape;
use markdown::{Markdown, MarkdownElement, MarkdownStyle};
use release_channel::ReleaseChannel;
use remote::ssh_session::{ConnectionIdentifier, SshPortForwardOption};
use remote::{SshConnectionOptions, SshPlatform, SshRemoteClient};
use remote::{
ConnectionIdentifier, RemoteClient, RemotePlatform, SshConnectionOptions, SshPortForwardOption,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsSources};
@@ -451,7 +452,7 @@ pub struct SshClientDelegate {
known_password: Option<String>,
}
impl remote::SshClientDelegate for SshClientDelegate {
impl remote::RemoteClientDelegate for SshClientDelegate {
fn ask_password(&self, prompt: String, tx: oneshot::Sender<String>, cx: &mut AsyncApp) {
let mut known_password = self.known_password.clone();
if let Some(password) = known_password.take() {
@@ -473,7 +474,7 @@ impl remote::SshClientDelegate for SshClientDelegate {
fn download_server_binary_locally(
&self,
platform: SshPlatform,
platform: RemotePlatform,
release_channel: ReleaseChannel,
version: Option<SemanticVersion>,
cx: &mut AsyncApp,
@@ -503,7 +504,7 @@ impl remote::SshClientDelegate for SshClientDelegate {
fn get_download_params(
&self,
platform: SshPlatform,
platform: RemotePlatform,
release_channel: ReleaseChannel,
version: Option<SemanticVersion>,
cx: &mut AsyncApp,
@@ -543,13 +544,13 @@ pub fn connect_over_ssh(
ui: Entity<SshPrompt>,
window: &mut Window,
cx: &mut App,
) -> Task<Result<Option<Entity<SshRemoteClient>>>> {
) -> Task<Result<Option<Entity<RemoteClient>>>> {
let window = window.window_handle();
let known_password = connection_options.password.clone();
let (tx, rx) = oneshot::channel();
ui.update(cx, |ui, _cx| ui.set_cancellation_tx(tx));
remote::SshRemoteClient::new(
remote::RemoteClient::ssh(
unique_identifier,
connection_options,
rx,
@@ -681,9 +682,9 @@ pub async fn open_ssh_project(
window
.update(cx, |workspace, _, cx| {
if let Some(client) = workspace.project().read(cx).ssh_client() {
if let Some(client) = workspace.project().read(cx).remote_client() {
ExtensionStore::global(cx)
.update(cx, |store, cx| store.register_ssh_client(client, cx));
.update(cx, |store, cx| store.register_remote_client(client, cx));
}
})
.ok();