@@ -1,5 +1,7 @@
1−use helix_dap::{Client, Result, SourceBreakpoint};
1+use helix_dap::{Client, Event, OutputEventBody, Result, SourceBreakpoint};
22use serde::{Deserialize, Serialize};
3+use serde_json::from_value;
4+use tokio::sync::mpsc::Receiver;
35
46#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
57#[serde(rename_all = "camelCase")]
@@ -8,6 +10,12 @@ struct LaunchArguments {
810 program: String,
911}
1012
13+async fn output(mut output_event: Receiver<Event>) {
14+ let body: OutputEventBody =
15+ from_value(output_event.recv().await.unwrap().body.unwrap()).unwrap();
16+ println!("{:?}", body);
17+}
18+
1119#[tokio::main]
1220pub async fn main() -> Result<()> {
1321 let base_config = fern::Dispatch::new().level(log::LevelFilter::Info);
@@ -25,6 +33,9 @@ pub async fn main() -> Result<()> {
2533 println!("create: {:?}", client);
2634 let mut client = client?;
2735
36+ let output_event = client.listen_for_event("output".to_owned()).await;
37+ tokio::spawn(output(output_event));
38+
2839 println!("init: {:?}", client.initialize("go".to_owned()).await);
2940 println!("caps: {:#?}", client.capabilities());
3041