debugger: Show child sessions as indented and ensure they're next to the parent session (#32939)

Closes #ISSUE

Release Notes:

- debugger: Tweaked how child sessions are shown in the session list.
This commit is contained in:
Piotr Osiewicz 2025-06-18 12:50:39 +02:00 committed by GitHub
parent 131f2857a5
commit 8e4031815d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 11 deletions

View file

@ -1142,7 +1142,9 @@ async fn register_session_inner(
let debug_session = DebugSession::running(
this.project.clone(),
this.workspace.clone(),
parent_session.map(|p| p.read(cx).running_state().read(cx).debug_terminal.clone()),
parent_session
.as_ref()
.map(|p| p.read(cx).running_state().read(cx).debug_terminal.clone()),
session,
serialized_layout,
this.position(window, cx).axis(),
@ -1157,8 +1159,14 @@ async fn register_session_inner(
|_, _, cx| cx.notify(),
)
.detach();
this.sessions.push(debug_session.clone());
let insert_position = this
.sessions
.iter()
.position(|session| Some(session) == parent_session.as_ref())
.map(|position| position + 1)
.unwrap_or(this.sessions.len());
// Maintain topological sort order of sessions
this.sessions.insert(insert_position, debug_session.clone());
debug_session
})?;