aboutsummaryrefslogtreecommitdiff
path: root/helix-dap/examples
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-12 13:35:15 +0000
committerBlaž Hrastnik2021-08-20 04:43:54 +0000
commit0f6e81b85be6e7e8f08446f3cd373da38dd67360 (patch)
tree7f79b7017ed700652f2dee868c88d084c5d0be4d /helix-dap/examples
parentd4c17b633c09ab2a0ba8794a6650dcfb67f50ea9 (diff)
Initial debug adapter protocol implementation
Diffstat (limited to 'helix-dap/examples')
-rw-r--r--helix-dap/examples/dap-basic.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/helix-dap/examples/dap-basic.rs b/helix-dap/examples/dap-basic.rs
new file mode 100644
index 00000000..45522516
--- /dev/null
+++ b/helix-dap/examples/dap-basic.rs
@@ -0,0 +1,51 @@
+use helix_dap::{Client, Result, SourceBreakpoint};
+
+#[tokio::main]
+pub async fn main() -> Result<()> {
+ let mut client = Client::start("nc", vec!["127.0.0.1", "7777"], 0)?;
+
+ println!("init: {:?}", client.initialize().await);
+ println!("caps: {:?}", client.capabilities());
+ println!(
+ "launch: {:?}",
+ client.launch("/tmp/godebug/main".to_owned()).await
+ );
+
+ println!(
+ "breakpoints: {:?}",
+ client
+ .set_breakpoints(
+ "/tmp/godebug/main.go".to_owned(),
+ vec![SourceBreakpoint {
+ line: 6,
+ column: Some(2),
+ }]
+ )
+ .await
+ );
+
+ let mut _in = String::new();
+ std::io::stdin()
+ .read_line(&mut _in)
+ .expect("Failed to read line");
+
+ println!("configurationDone: {:?}", client.configuration_done().await);
+ println!("stopped: {:?}", client.wait_for_stopped().await);
+ println!("stack trace: {:?}", client.stack_trace(1).await);
+
+ let mut _in = String::new();
+ std::io::stdin()
+ .read_line(&mut _in)
+ .expect("Failed to read line");
+
+ println!("continued: {:?}", client.continue_thread(0).await);
+
+ let mut _in = String::new();
+ std::io::stdin()
+ .read_line(&mut _in)
+ .expect("Failed to read line");
+
+ println!("disconnect: {:?}", client.disconnect().await);
+
+ Ok(())
+}