debugger: Don't spin forever when adapter disconnects unexpectedly (#32489)
Closes #ISSUE Release Notes: - Debugger Beta: made the debug panel UI more helpful when an invalid configuration is sent to the debug adapter. --------- Co-authored-by: Anthony Eid <hello@anthonyeid.me> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
e62e9facf0
commit
e4f8c4fb4c
2 changed files with 32 additions and 8 deletions
|
@ -27,6 +27,7 @@ use dap::{
|
|||
ExceptionBreakpointsFilter, ExceptionFilterOptions, OutputEvent, OutputEventCategory,
|
||||
RunInTerminalRequestArguments, StartDebuggingRequestArguments,
|
||||
};
|
||||
use futures::SinkExt;
|
||||
use futures::channel::{mpsc, oneshot};
|
||||
use futures::{FutureExt, future::Shared};
|
||||
use gpui::{
|
||||
|
@ -458,7 +459,7 @@ impl RunningMode {
|
|||
let task = cx.background_spawn(futures::future::try_join(launch, configuration_sequence));
|
||||
|
||||
cx.spawn(async move |this, cx| {
|
||||
task.await?;
|
||||
let result = task.await;
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
if let Some(this) = this.as_running_mut() {
|
||||
|
@ -468,6 +469,7 @@ impl RunningMode {
|
|||
})
|
||||
.ok();
|
||||
|
||||
result?;
|
||||
anyhow::Ok(())
|
||||
})
|
||||
}
|
||||
|
@ -823,7 +825,7 @@ impl Session {
|
|||
id,
|
||||
parent_session,
|
||||
worktree.downgrade(),
|
||||
binary,
|
||||
binary.clone(),
|
||||
message_tx,
|
||||
cx.clone(),
|
||||
)
|
||||
|
@ -836,10 +838,26 @@ impl Session {
|
|||
this.update(cx, |session, cx| session.request_initialize(cx))?
|
||||
.await?;
|
||||
|
||||
this.update(cx, |session, cx| {
|
||||
session.initialize_sequence(initialized_rx, dap_store.clone(), cx)
|
||||
})?
|
||||
.await
|
||||
let result = this
|
||||
.update(cx, |session, cx| {
|
||||
session.initialize_sequence(initialized_rx, dap_store.clone(), cx)
|
||||
})?
|
||||
.await;
|
||||
|
||||
if result.is_err() {
|
||||
let mut console = this.update(cx, |session, cx| session.console_output(cx))?;
|
||||
|
||||
console
|
||||
.send(format!(
|
||||
"Tried to launch debugger with: {}",
|
||||
serde_json::to_string_pretty(&binary.request_args.configuration)
|
||||
.unwrap_or_default(),
|
||||
))
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
|
||||
result
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue