From c5b210df59983a2caa9c389e5cd22aa670fb4a00 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Mon, 23 Aug 2021 16:48:06 +0300 Subject: Add debug-adapter field to languages.toml --- helix-dap/src/client.rs | 10 ++++------ helix-dap/src/types.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'helix-dap') diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 98b88e23..79c65cf7 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -113,16 +113,14 @@ impl Client { } pub async fn tcp_process( - cmd: &str, - args: Vec<&str>, - port_format: &str, + config: DebugAdapterConfig, id: usize, ) -> Result<(Self, UnboundedReceiver)> { let port = Self::get_port().await.unwrap(); - let process = Command::new(cmd) - .args(args) - .args(port_format.replace("{}", &port.to_string()).split(' ')) + let process = Command::new(config.command) + .args(config.args) + .args(config.port_arg.replace("{}", &port.to_string()).split(' ')) // silence messages .stdin(Stdio::null()) .stdout(Stdio::null()) diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index 26cd69fb..152996a1 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -2,6 +2,14 @@ use serde::{Deserialize, Serialize}; use serde_json::Value; use std::path::PathBuf; +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +pub struct DebugAdapterConfig { + pub command: String, + pub args: Vec, + pub port_arg: String, +} + pub trait Request { type Arguments: serde::de::DeserializeOwned + serde::Serialize; type Result: serde::de::DeserializeOwned + serde::Serialize; -- cgit v1.2.3-70-g09d2