diff --git a/Cargo.lock b/Cargo.lock index c9f89cf4f..bb3aa1161 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1351,6 +1351,7 @@ dependencies = [ "helix-stdx", "log", "serde", + "serde-aux", "serde_json", "thiserror", "tokio", @@ -2241,6 +2242,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-aux" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d2e8bfba469d06512e11e3311d4d051a4a387a5b42d010404fecf3200321c95" +dependencies = [ + "chrono", + "serde", + "serde_json", +] + [[package]] name = "serde_derive" version = "1.0.203" diff --git a/helix-dap/Cargo.toml b/helix-dap/Cargo.toml index 3521f5890..3c75406bc 100644 --- a/helix-dap/Cargo.toml +++ b/helix-dap/Cargo.toml @@ -19,6 +19,7 @@ helix-core = { path = "../helix-core" } anyhow = "1.0" log = "0.4" serde = { version = "1.0", features = ["derive"] } +serde-aux = "4.5" serde_json = "1.0" thiserror = "1.0" tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "net", "sync"] } diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index bbaf53a60..d3abb56ed 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use serde_aux::prelude::deserialize_string_from_number; use serde_json::Value; use std::collections::HashMap; use std::path::PathBuf; @@ -311,7 +312,8 @@ pub struct Variable { #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Module { - pub id: String, // TODO: || number + #[serde(deserialize_with = "deserialize_string_from_number")] + pub id: String, pub name: String, #[serde(skip_serializing_if = "Option::is_none")] pub path: Option,