debugger: Update the default layout (#31057)

- Remove the modules list and loaded sources list from the default
layout
- Move the console to the center pane so it's visible initially

Release Notes:

- Debugger Beta: changed the default layout of the debugger panel,
hiding the modules list and loaded sources list by default and making
the console more prominent.

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
This commit is contained in:
Cole Miller 2025-05-22 00:32:44 -04:00 committed by GitHub
parent 97e437c632
commit 71fb17c507
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 85 additions and 77 deletions

View file

@ -24,7 +24,7 @@ use dap::{
messages::{Events, Message},
};
use dap::{
ExceptionBreakpointsFilter, ExceptionFilterOptions, OutputEventCategory,
ExceptionBreakpointsFilter, ExceptionFilterOptions, OutputEvent, OutputEventCategory,
RunInTerminalRequestArguments, StartDebuggingRequestArguments,
};
use futures::channel::{mpsc, oneshot};
@ -674,6 +674,7 @@ pub enum SessionEvent {
request: RunInTerminalRequestArguments,
sender: mpsc::Sender<Result<u32>>,
},
ConsoleOutput,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@ -885,9 +886,8 @@ impl Session {
cx.spawn(async move |this, cx| {
while let Some(output) = rx.next().await {
this.update(cx, |this, _| {
this.output_token.0 += 1;
this.output.push_back(dap::OutputEvent {
this.update(cx, |this, cx| {
let event = dap::OutputEvent {
category: None,
output,
group: None,
@ -897,7 +897,8 @@ impl Session {
column: None,
data: None,
location_reference: None,
});
};
this.push_output(event, cx);
})?;
}
anyhow::Ok(())
@ -1266,8 +1267,7 @@ impl Session {
return;
}
self.output.push_back(event);
self.output_token.0 += 1;
self.push_output(event, cx);
cx.notify();
}
Events::Breakpoint(event) => self.breakpoint_store.update(cx, |store, _| {
@ -1445,6 +1445,12 @@ impl Session {
});
}
fn push_output(&mut self, event: OutputEvent, cx: &mut Context<Self>) {
self.output.push_back(event);
self.output_token.0 += 1;
cx.emit(SessionEvent::ConsoleOutput);
}
pub fn any_stopped_thread(&self) -> bool {
self.thread_states.any_stopped_thread()
}
@ -2063,8 +2069,7 @@ impl Session {
source: Option<Source>,
cx: &mut Context<Self>,
) -> Task<()> {
self.output_token.0 += 1;
self.output.push_back(dap::OutputEvent {
let event = dap::OutputEvent {
category: None,
output: format!("> {expression}"),
group: None,
@ -2074,7 +2079,8 @@ impl Session {
column: None,
data: None,
location_reference: None,
});
};
self.push_output(event, cx);
let request = self.mode.request_dap(EvaluateCommand {
expression,
context,
@ -2086,8 +2092,7 @@ impl Session {
this.update(cx, |this, cx| {
match response {
Ok(response) => {
this.output_token.0 += 1;
this.output.push_back(dap::OutputEvent {
let event = dap::OutputEvent {
category: None,
output: format!("< {}", &response.result),
group: None,
@ -2097,11 +2102,11 @@ impl Session {
column: None,
data: None,
location_reference: None,
});
};
this.push_output(event, cx);
}
Err(e) => {
this.output_token.0 += 1;
this.output.push_back(dap::OutputEvent {
let event = dap::OutputEvent {
category: None,
output: format!("{}", e),
group: None,
@ -2111,7 +2116,8 @@ impl Session {
column: None,
data: None,
location_reference: None,
});
};
this.push_output(event, cx);
}
};
this.invalidate_command_type::<ScopesCommand>();