diff options
author | Dmitry Sharshakov | 2021-08-29 11:51:47 +0000 |
---|---|---|
committer | Dmitry Sharshakov | 2021-08-29 11:51:47 +0000 |
commit | b42631942b74b2f5ac5c955343861518c38282e8 (patch) | |
tree | 4e65d987e3cca61c59bf8a6141738c1915c36939 /helix-dap | |
parent | f53d8411cbda6119bcd34d5936fc23c1365bafef (diff) |
Defaults in completions, better schema
Diffstat (limited to 'helix-dap')
-rw-r--r-- | helix-dap/src/client.rs | 26 | ||||
-rw-r--r-- | helix-dap/src/types.rs | 22 |
2 files changed, 12 insertions, 36 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index ed4f8ed5..889ca89f 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -38,28 +38,24 @@ pub struct Client { impl Client { // Spawn a process and communicate with it by either TCP or stdio pub async fn process( - cfg: DebugAdapterConfig, + transport: String, + command: String, + args: Vec<String>, + port_arg: Option<String>, id: usize, ) -> Result<(Self, UnboundedReceiver<Payload>)> { - if cfg.transport == "tcp" && cfg.port_arg.is_some() { + if transport == "tcp" && port_arg.is_some() { Self::tcp_process( - &cfg.command, - cfg.args.iter().map(|s| s.as_str()).collect(), - &cfg.port_arg.unwrap(), + &command, + args.iter().map(|s| s.as_str()).collect(), + &port_arg.unwrap(), id, ) .await - } else if cfg.transport == "stdio" { - Self::stdio( - &cfg.command, - cfg.args.iter().map(|s| s.as_str()).collect(), - id, - ) + } else if transport == "stdio" { + Self::stdio(&command, args.iter().map(|s| s.as_str()).collect(), id) } else { - Result::Err(Error::Other(anyhow!( - "Incorrect transport {}", - cfg.transport - ))) + Result::Err(Error::Other(anyhow!("Incorrect transport {}", transport))) } } diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index 7207f412..c1781243 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -1,26 +1,6 @@ use serde::{Deserialize, Serialize}; use serde_json::Value; -use std::{collections::HashMap, path::PathBuf}; - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "kebab-case")] -pub struct DebugTemplate { - pub name: String, - pub request: String, - pub completion: Vec<String>, - pub args: HashMap<String, String>, -} - -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "kebab-case")] -pub struct DebugAdapterConfig { - pub name: String, - pub transport: String, - pub command: String, - pub args: Vec<String>, - pub port_arg: Option<String>, - pub templates: Vec<DebugTemplate>, -} +use std::path::PathBuf; pub trait Request { type Arguments: serde::de::DeserializeOwned + serde::Serialize; |