debugger: Remember pane layout from previous debugger session (#28692)

This PR makes a debugger's pane layout persistent across session's that
use the same debug adapter.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
Anthony Eid 2025-04-15 02:32:28 -04:00 committed by GitHub
parent b794919842
commit d4761cea47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 550 additions and 150 deletions

View file

@ -30,7 +30,8 @@ use dap::{
use futures::channel::oneshot;
use futures::{FutureExt, future::Shared};
use gpui::{
App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, Task, WeakEntity,
App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, SharedString,
Task, WeakEntity,
};
use rpc::AnyProtoClient;
use serde_json::{Value, json};
@ -125,6 +126,7 @@ type UpstreamProjectId = u64;
struct RemoteConnection {
_client: AnyProtoClient,
_upstream_project_id: UpstreamProjectId,
_adapter_name: SharedString,
}
impl RemoteConnection {
@ -996,6 +998,7 @@ impl Session {
) -> Self {
Self {
mode: Mode::Remote(RemoteConnection {
_adapter_name: SharedString::new(""), // todo(debugger) we need to pipe in the right values to deserialize the debugger pane layout
_client: client,
_upstream_project_id: upstream_project_id,
}),
@ -1044,6 +1047,13 @@ impl Session {
&self.capabilities
}
pub fn adapter_name(&self) -> SharedString {
match &self.mode {
Mode::Local(local_mode) => local_mode.adapter.name().into(),
Mode::Remote(remote_mode) => remote_mode._adapter_name.clone(),
}
}
pub fn configuration(&self) -> Option<DebugAdapterConfig> {
if let Mode::Local(local_mode) = &self.mode {
Some(local_mode.config.clone())