Skip to content

Commit f92275a

Browse files
authored
feat: dedicated crate for DAP types (#14906)
1 parent 9b5696e commit f92275a

File tree

7 files changed

+36
-8
lines changed

7 files changed

+36
-8
lines changed

Cargo.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ members = [
88
"helix-lsp-types",
99
"helix-lsp",
1010
"helix-event",
11+
"helix-dap-types",
1112
"helix-dap",
1213
"helix-loader",
1314
"helix-vcs",

helix-dap-types/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "helix-dap-types"
3+
description = "Types for interaction with a debug adapaters, using Debug Adapter Protocol"
4+
version.workspace = true
5+
authors.workspace = true
6+
edition.workspace = true
7+
license.workspace = true
8+
rust-version.workspace = true
9+
categories.workspace = true
10+
repository.workspace = true
11+
homepage.workspace = true
12+
13+
[dependencies]
14+
serde = { version = "1.0", features = ["derive"] }
15+
serde_json = "1.0"
File renamed without changes.

helix-dap/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ homepage.workspace = true
1515
[dependencies]
1616
helix-stdx = { path = "../helix-stdx" }
1717
helix-core = { path = "../helix-core" }
18+
helix-dap-types = { path = "../helix-dap-types" }
1819

1920
anyhow = "1.0"
2021
log = "0.4"

helix-dap/src/client.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::{
22
registry::DebugAdapterId,
33
requests::{DisconnectArguments, TerminateArguments},
44
transport::{Payload, Request, Response, Transport},
5-
types::*,
65
Error, Result,
76
};
87
use helix_core::syntax::config::{DebugAdapterConfig, DebuggerQuirks};
8+
use helix_dap_types::*;
99

1010
use serde_json::Value;
1111

@@ -249,7 +249,7 @@ impl Client {
249249
}
250250

251251
/// Execute a RPC request on the debugger.
252-
pub fn call<R: crate::types::Request>(
252+
pub fn call<R: helix_dap_types::Request>(
253253
&self,
254254
arguments: R::Arguments,
255255
) -> impl Future<Output = Result<Value>>
@@ -288,7 +288,10 @@ impl Client {
288288
}
289289
}
290290

291-
pub async fn request<R: crate::types::Request>(&self, params: R::Arguments) -> Result<R::Result>
291+
pub async fn request<R: helix_dap_types::Request>(
292+
&self,
293+
params: R::Arguments,
294+
) -> Result<R::Result>
292295
where
293296
R::Arguments: serde::Serialize,
294297
R::Result: core::fmt::Debug, // TODO: temporary

helix-dap/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
mod client;
22
pub mod registry;
33
mod transport;
4-
mod types;
54

65
pub use client::Client;
6+
pub use helix_dap_types::*;
77
pub use transport::{Payload, Response, Transport};
8-
pub use types::*;
98

109
use serde::de::DeserializeOwned;
1110

@@ -43,13 +42,13 @@ impl From<sonic_rs::Error> for Error {
4342

4443
#[derive(Debug)]
4544
pub enum Request {
46-
RunInTerminal(<requests::RunInTerminal as types::Request>::Arguments),
47-
StartDebugging(<requests::StartDebugging as types::Request>::Arguments),
45+
RunInTerminal(<requests::RunInTerminal as helix_dap_types::Request>::Arguments),
46+
StartDebugging(<requests::StartDebugging as helix_dap_types::Request>::Arguments),
4847
}
4948

5049
impl Request {
5150
pub fn parse(command: &str, arguments: Option<serde_json::Value>) -> Result<Self> {
52-
use crate::types::Request as _;
51+
use helix_dap_types::Request as _;
5352

5453
let arguments = arguments.unwrap_or_default();
5554
let request = match command {

0 commit comments

Comments
 (0)