Skip to content

Commit

Permalink
Initial debug adapter protocol implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dsseng authored and archseer committed Aug 20, 2021
1 parent d4c17b6 commit 0f6e81b
Show file tree
Hide file tree
Showing 7 changed files with 739 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"helix-tui",
"helix-syntax",
"helix-lsp",
"helix-dap"
]

# Build helix-syntax in release mode to make the code path faster in development.
Expand Down
20 changes: 20 additions & 0 deletions helix-dap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "helix-dap"
version = "0.3.0"
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
edition = "2018"
license = "MPL-2.0"
description = "DAP client implementation for Helix project"
categories = ["editor"]
repository = "https://github.com/helix-editor/helix"
homepage = "https://helix-editor.com"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0"
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
tokio = { version = "1.9", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot"] }
51 changes: 51 additions & 0 deletions helix-dap/examples/dap-basic.rs
Original file line number Diff line number Diff line change
@@ -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(())
}
Loading

0 comments on commit 0f6e81b

Please sign in to comment.