From f1f5d602fcfa06538c7d70bb6eda82a945549d6c Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:25:50 -0400 Subject: [PATCH] debugger: Save debug session layout when changing focus or closing session (#28788) This fixes a bug where resizing the panes wouldn't be serialized and persist Release Notes: - N/A Co-authored-by: Piotr Osiewicz --- crates/debugger_ui/src/debugger_panel.rs | 8 +++++++- crates/debugger_ui/src/session/running.rs | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index 9cec74d27e1bacb1ecd34bd96312127d2d7f8022..336783212f101c048ea0693edbb01a0a2089fbbd 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -438,7 +438,13 @@ impl DebugPanel { else { return; }; - + session.update(cx, |this, cx| { + if let Some(running) = this.mode().as_running() { + running.update(cx, |this, cx| { + this.serialize_layout(window, cx); + }); + } + }); let session_id = session.update(cx, |this, cx| this.session_id(cx)); let should_prompt = self .project diff --git a/crates/debugger_ui/src/session/running.rs b/crates/debugger_ui/src/session/running.rs index d948ba300915194d9055a981cc30eaccf518f9d6..80ce42d2d603c10470718256e86cbf57f0183185 100644 --- a/crates/debugger_ui/src/session/running.rs +++ b/crates/debugger_ui/src/session/running.rs @@ -421,6 +421,9 @@ impl RunningState { } cx.notify() }), + cx.on_focus_out(&focus_handle, window, |this, _, window, cx| { + this.serialize_layout(window, cx); + }), ]; let mut pane_close_subscriptions = HashMap::default(); @@ -476,7 +479,7 @@ impl RunningState { } } - fn serialize_layout(&mut self, window: &mut Window, cx: &mut Context) { + pub(crate) fn serialize_layout(&mut self, window: &mut Window, cx: &mut Context) { if self._schedule_serialize.is_none() { self._schedule_serialize = Some(cx.spawn_in(window, async move |this, cx| { cx.background_executor()