aboutsummaryrefslogtreecommitdiff
path: root/helix-dap
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-23 13:48:06 +0000
committerDmitry Sharshakov2021-08-23 13:48:06 +0000
commitc5b210df59983a2caa9c389e5cd22aa670fb4a00 (patch)
tree0db7e64a51a34e7bad746d59d0b610c34820b335 /helix-dap
parentdabec2d7993b23d08f03b52dc08176d437a110a9 (diff)
Add debug-adapter field to languages.toml
Diffstat (limited to 'helix-dap')
-rw-r--r--helix-dap/src/client.rs10
-rw-r--r--helix-dap/src/types.rs8
2 files changed, 12 insertions, 6 deletions
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<Payload>)> {
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<String>,
+ pub port_arg: String,
+}
+
pub trait Request {
type Arguments: serde::de::DeserializeOwned + serde::Serialize;
type Result: serde::de::DeserializeOwned + serde::Serialize;