| Crates.io | emmy_dap_types |
| lib.rs | emmy_dap_types |
| version | 0.2.0 |
| created_at | 2025-10-28 02:35:06.186622+00 |
| updated_at | 2025-11-18 02:59:31.069774+00 |
| description | Rust types for Debug Adapter Protocol (DAP) - forked from dap-rs with cross-editor compatibility enhancements |
| homepage | |
| repository | https://github.com/EmmyLuaLs/emmy_dap_types |
| max_upload_size | |
| id | 1903998 |
| size | 218,291 |
A Rust implementation of the Debug Adapter Protocol (DAP) types and utilities.
This project is a fork of dap-rs with additional improvements and cross-editor compatibility enhancements.
emmy_dap_types provides strongly-typed Rust structures for the Debug Adapter Protocol, making it easy to build debug adapters or debug clients in Rust.
arguments objects vs. missing fields)serdeAdd this to your Cargo.toml:
[dependencies]
emmy_dap_types = "0.1"
use emmy_dap_types::prelude::*;
use std::io::{stdin, stdout};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let input = stdin();
let output = stdout();
let mut server = Server::new(input, output);
loop {
let req: Request = server.poll_request()?;
match req.command {
Command::Initialize(args) => {
// Handle initialize request
let response = req.success(ResponseBody::Initialize(Some(Capabilities {
supports_configuration_done_request: Some(true),
// ... other capabilities
..Default::default()
})));
server.respond(response)?;
}
Command::Launch(_) => {
// Handle launch request
let response = req.success(ResponseBody::Launch);
server.respond(response)?;
}
Command::Threads => {
// Handle threads request
let response = req.success(ResponseBody::Threads(ThreadsResponseBody {
threads: vec![],
}));
server.respond(response)?;
}
_ => {
// Handle other commands
}
}
}
}
The original dap-rs had issues with clients like Zed and IntelliJ IDEA that send empty arguments: {} objects for commands that don't require arguments, while VS Code omits the field entirely.
This fork implements a custom deserializer that accepts both formats:
// VS Code style (no arguments field)
{"command": "threads", "seq": 1, "type": "request"}
// Zed/IntelliJ style (empty arguments object)
{"command": "threads", "seq": 1, "type": "request", "arguments": {}}
Both formats deserialize correctly to the same Command::Threads variant.
Removed conditional compilation attributes (#[cfg_attr(feature = "client", ...)]) to ensure Serialize and Deserialize are always available, improving ergonomics and compatibility.
The Server implementation has been optimized to reduce the number of write operations, improving performance for high-frequency request/response scenarios.
The crate is organized into several modules:
requests - Request types and the Command enumresponses - Response types and bodiesevents - Event types sent by the debug adaptertypes - Common types used across requests, responses, and eventsserver - I/O utilities for implementing a debug adaptererrors - Error typesThis implementation follows the Debug Adapter Protocol Specification. All protocol types are documented with links to the corresponding specification sections.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is a fork of dap-rs by @sztomi. Special thanks to the original author for the foundational work.
This project is licensed under the MIT License - see the LICENSE file for details.