Remove some mentions of ssh in dap store and project

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Max Brunsfeld 2025-08-26 12:12:05 -07:00
parent e0223add54
commit d95f2342e8
2 changed files with 63 additions and 56 deletions

View file

@ -68,7 +68,7 @@ pub enum DapStoreEvent {
enum DapStoreMode { enum DapStoreMode {
Local(LocalDapStore), Local(LocalDapStore),
Ssh(SshDapStore), Remote(RemoteDapStore),
Collab, Collab,
} }
@ -80,8 +80,8 @@ pub struct LocalDapStore {
toolchain_store: Arc<dyn LanguageToolchainStore>, toolchain_store: Arc<dyn LanguageToolchainStore>,
} }
pub struct SshDapStore { pub struct RemoteDapStore {
ssh_client: Entity<RemoteClient>, remote_client: Entity<RemoteClient>,
upstream_client: AnyProtoClient, upstream_client: AnyProtoClient,
upstream_project_id: u64, upstream_project_id: u64,
} }
@ -147,16 +147,16 @@ impl DapStore {
Self::new(mode, breakpoint_store, worktree_store, cx) Self::new(mode, breakpoint_store, worktree_store, cx)
} }
pub fn new_ssh( pub fn new_remote(
project_id: u64, project_id: u64,
ssh_client: Entity<RemoteClient>, remote_client: Entity<RemoteClient>,
breakpoint_store: Entity<BreakpointStore>, breakpoint_store: Entity<BreakpointStore>,
worktree_store: Entity<WorktreeStore>, worktree_store: Entity<WorktreeStore>,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> Self { ) -> Self {
let mode = DapStoreMode::Ssh(SshDapStore { let mode = DapStoreMode::Remote(RemoteDapStore {
upstream_client: ssh_client.read(cx).proto_client(), upstream_client: remote_client.read(cx).proto_client(),
ssh_client, remote_client,
upstream_project_id: project_id, upstream_project_id: project_id,
}); });
@ -242,20 +242,22 @@ impl DapStore {
Ok(binary) Ok(binary)
}) })
} }
DapStoreMode::Ssh(ssh) => { DapStoreMode::Remote(remote) => {
let request = ssh.upstream_client.request(proto::GetDebugAdapterBinary { let request = remote
session_id: session_id.to_proto(), .upstream_client
project_id: ssh.upstream_project_id, .request(proto::GetDebugAdapterBinary {
worktree_id: worktree.read(cx).id().to_proto(), session_id: session_id.to_proto(),
definition: Some(definition.to_proto()), project_id: remote.upstream_project_id,
}); worktree_id: worktree.read(cx).id().to_proto(),
let ssh_client = ssh.ssh_client.clone(); definition: Some(definition.to_proto()),
});
let remote = remote.remote_client.clone();
cx.spawn(async move |_, cx| { cx.spawn(async move |_, cx| {
let response = request.await?; let response = request.await?;
let binary = DebugAdapterBinary::from_proto(response)?; let binary = DebugAdapterBinary::from_proto(response)?;
let (mut ssh_command, envs, path_style, ssh_shell) = let (mut ssh_command, envs, path_style, ssh_shell) =
ssh_client.read_with(cx, |ssh, _| { remote.read_with(cx, |ssh, _| {
let SshInfo { let SshInfo {
args: SshArgs { arguments, envs }, args: SshArgs { arguments, envs },
path_style, path_style,
@ -365,9 +367,9 @@ impl DapStore {
))) )))
} }
} }
DapStoreMode::Ssh(ssh) => { DapStoreMode::Remote(remote) => {
let request = ssh.upstream_client.request(proto::RunDebugLocators { let request = remote.upstream_client.request(proto::RunDebugLocators {
project_id: ssh.upstream_project_id, project_id: remote.upstream_project_id,
build_command: Some(build_command.to_proto()), build_command: Some(build_command.to_proto()),
locator: locator_name.to_owned(), locator: locator_name.to_owned(),
}); });

View file

@ -1184,7 +1184,7 @@ impl Project {
} }
pub fn remote( pub fn remote(
ssh: Entity<RemoteClient>, remote: Entity<RemoteClient>,
client: Arc<Client>, client: Arc<Client>,
node: NodeRuntime, node: NodeRuntime,
user_store: Entity<UserStore>, user_store: Entity<UserStore>,
@ -1200,12 +1200,12 @@ impl Project {
let snippets = let snippets =
SnippetProvider::new(fs.clone(), BTreeSet::from_iter([global_snippets_dir]), cx); SnippetProvider::new(fs.clone(), BTreeSet::from_iter([global_snippets_dir]), cx);
let (ssh_proto, path_style) = let (remote_proto, path_style) =
ssh.read_with(cx, |ssh, _| (ssh.proto_client(), ssh.path_style())); remote.read_with(cx, |remote, _| (remote.proto_client(), remote.path_style()));
let worktree_store = cx.new(|_| { let worktree_store = cx.new(|_| {
WorktreeStore::remote( WorktreeStore::remote(
false, false,
ssh_proto.clone(), remote_proto.clone(),
REMOTE_SERVER_PROJECT_ID, REMOTE_SERVER_PROJECT_ID,
path_style, path_style,
) )
@ -1220,7 +1220,7 @@ impl Project {
let buffer_store = cx.new(|cx| { let buffer_store = cx.new(|cx| {
BufferStore::remote( BufferStore::remote(
worktree_store.clone(), worktree_store.clone(),
ssh.read(cx).proto_client(), remote.read(cx).proto_client(),
REMOTE_SERVER_PROJECT_ID, REMOTE_SERVER_PROJECT_ID,
cx, cx,
) )
@ -1228,7 +1228,7 @@ impl Project {
let image_store = cx.new(|cx| { let image_store = cx.new(|cx| {
ImageStore::remote( ImageStore::remote(
worktree_store.clone(), worktree_store.clone(),
ssh.read(cx).proto_client(), remote.read(cx).proto_client(),
REMOTE_SERVER_PROJECT_ID, REMOTE_SERVER_PROJECT_ID,
cx, cx,
) )
@ -1236,7 +1236,7 @@ impl Project {
cx.subscribe(&buffer_store, Self::on_buffer_store_event) cx.subscribe(&buffer_store, Self::on_buffer_store_event)
.detach(); .detach();
let toolchain_store = cx.new(|cx| { let toolchain_store = cx.new(|cx| {
ToolchainStore::remote(REMOTE_SERVER_PROJECT_ID, ssh.read(cx).proto_client(), cx) ToolchainStore::remote(REMOTE_SERVER_PROJECT_ID, remote.read(cx).proto_client(), cx)
}); });
let task_store = cx.new(|cx| { let task_store = cx.new(|cx| {
TaskStore::remote( TaskStore::remote(
@ -1244,7 +1244,7 @@ impl Project {
buffer_store.downgrade(), buffer_store.downgrade(),
worktree_store.clone(), worktree_store.clone(),
toolchain_store.read(cx).as_language_toolchain_store(), toolchain_store.read(cx).as_language_toolchain_store(),
ssh.read(cx).proto_client(), remote.read(cx).proto_client(),
REMOTE_SERVER_PROJECT_ID, REMOTE_SERVER_PROJECT_ID,
cx, cx,
) )
@ -1268,7 +1268,7 @@ impl Project {
buffer_store.clone(), buffer_store.clone(),
worktree_store.clone(), worktree_store.clone(),
languages.clone(), languages.clone(),
ssh_proto.clone(), remote_proto.clone(),
REMOTE_SERVER_PROJECT_ID, REMOTE_SERVER_PROJECT_ID,
fs.clone(), fs.clone(),
cx, cx,
@ -1277,12 +1277,12 @@ impl Project {
cx.subscribe(&lsp_store, Self::on_lsp_store_event).detach(); cx.subscribe(&lsp_store, Self::on_lsp_store_event).detach();
let breakpoint_store = let breakpoint_store =
cx.new(|_| BreakpointStore::remote(REMOTE_SERVER_PROJECT_ID, ssh_proto.clone())); cx.new(|_| BreakpointStore::remote(REMOTE_SERVER_PROJECT_ID, remote_proto.clone()));
let dap_store = cx.new(|cx| { let dap_store = cx.new(|cx| {
DapStore::new_ssh( DapStore::new_remote(
REMOTE_SERVER_PROJECT_ID, REMOTE_SERVER_PROJECT_ID,
ssh.clone(), remote.clone(),
breakpoint_store.clone(), breakpoint_store.clone(),
worktree_store.clone(), worktree_store.clone(),
cx, cx,
@ -1290,10 +1290,15 @@ impl Project {
}); });
let git_store = cx.new(|cx| { let git_store = cx.new(|cx| {
GitStore::ssh(&worktree_store, buffer_store.clone(), ssh_proto.clone(), cx) GitStore::ssh(
&worktree_store,
buffer_store.clone(),
remote_proto.clone(),
cx,
)
}); });
cx.subscribe(&ssh, Self::on_remote_client_event).detach(); cx.subscribe(&remote, Self::on_remote_client_event).detach();
let this = Self { let this = Self {
buffer_ordered_messages_tx: tx, buffer_ordered_messages_tx: tx,
@ -1336,7 +1341,7 @@ impl Project {
user_store, user_store,
settings_observer, settings_observer,
fs, fs,
remote_client: Some(ssh.clone()), remote_client: Some(remote.clone()),
buffers_needing_diff: Default::default(), buffers_needing_diff: Default::default(),
git_diff_debouncer: DebouncedDelay::new(), git_diff_debouncer: DebouncedDelay::new(),
terminals: Terminals { terminals: Terminals {
@ -1355,28 +1360,28 @@ impl Project {
}; };
// remote server -> local machine handlers // remote server -> local machine handlers
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &cx.entity()); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &cx.entity());
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.buffer_store); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.buffer_store);
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.worktree_store); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.worktree_store);
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.lsp_store); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.lsp_store);
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.dap_store); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.dap_store);
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.settings_observer); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.settings_observer);
ssh_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.git_store); remote_proto.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &this.git_store);
ssh_proto.add_entity_message_handler(Self::handle_create_buffer_for_peer); remote_proto.add_entity_message_handler(Self::handle_create_buffer_for_peer);
ssh_proto.add_entity_message_handler(Self::handle_update_worktree); remote_proto.add_entity_message_handler(Self::handle_update_worktree);
ssh_proto.add_entity_message_handler(Self::handle_update_project); remote_proto.add_entity_message_handler(Self::handle_update_project);
ssh_proto.add_entity_message_handler(Self::handle_toast); remote_proto.add_entity_message_handler(Self::handle_toast);
ssh_proto.add_entity_request_handler(Self::handle_language_server_prompt_request); remote_proto.add_entity_request_handler(Self::handle_language_server_prompt_request);
ssh_proto.add_entity_message_handler(Self::handle_hide_toast); remote_proto.add_entity_message_handler(Self::handle_hide_toast);
ssh_proto.add_entity_request_handler(Self::handle_update_buffer_from_remote_server); remote_proto.add_entity_request_handler(Self::handle_update_buffer_from_remote_server);
BufferStore::init(&ssh_proto); BufferStore::init(&remote_proto);
LspStore::init(&ssh_proto); LspStore::init(&remote_proto);
SettingsObserver::init(&ssh_proto); SettingsObserver::init(&remote_proto);
TaskStore::init(Some(&ssh_proto)); TaskStore::init(Some(&remote_proto));
ToolchainStore::init(&ssh_proto); ToolchainStore::init(&remote_proto);
DapStore::init(&ssh_proto, cx); DapStore::init(&remote_proto, cx);
GitStore::init(&ssh_proto); GitStore::init(&remote_proto);
this this
}) })