Debug adapters log to console (#29957)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
de554589a8
commit
68793c0ac2
19 changed files with 268 additions and 330 deletions
|
@ -170,7 +170,7 @@ impl LocalMode {
|
|||
} else {
|
||||
DebugAdapterClient::start(session_id, binary.clone(), message_handler, cx.clone())
|
||||
.await
|
||||
.with_context(|| "Failed to start communication with debug adapter")?
|
||||
.with_context(|| format!("Failed to start {:?}", &binary.command))?
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -815,6 +815,33 @@ impl Session {
|
|||
self.is_session_terminated
|
||||
}
|
||||
|
||||
pub fn console_output(&mut self, cx: &mut Context<Self>) -> mpsc::UnboundedSender<String> {
|
||||
let (tx, mut rx) = mpsc::unbounded();
|
||||
|
||||
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 {
|
||||
category: None,
|
||||
output,
|
||||
group: None,
|
||||
variables_reference: None,
|
||||
source: None,
|
||||
line: None,
|
||||
column: None,
|
||||
data: None,
|
||||
location_reference: None,
|
||||
});
|
||||
})?;
|
||||
}
|
||||
anyhow::Ok(())
|
||||
})
|
||||
.detach();
|
||||
|
||||
return tx;
|
||||
}
|
||||
|
||||
pub fn is_local(&self) -> bool {
|
||||
matches!(self.mode, Mode::Running(_))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue