From d943a51e3e8e2cd77cc336c30eb954378e81fe31 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sun, 26 Sep 2021 21:36:06 +0300 Subject: editor: add Node.js debugger --- helix-dap/src/client.rs | 13 +++++++++++++ helix-dap/src/lib.rs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'helix-dap') diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 8dd41868..832a70c2 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -5,6 +5,7 @@ use crate::{ }; use anyhow::anyhow; pub use log::{error, info}; +use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, net::{IpAddr, Ipv4Addr, SocketAddr}, @@ -20,6 +21,13 @@ use tokio::{ time, }; +// Different workarounds for adapters' differences +#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)] +pub struct DebuggerQuirks { + #[serde(default)] + pub absolute_paths: bool, +} + #[derive(Debug)] pub struct Client { id: usize, @@ -34,6 +42,7 @@ pub struct Client { /// Currently active frame for the current thread. pub active_frame: Option, pub breakpoints: Vec, + pub quirks: DebuggerQuirks, } impl Client { @@ -45,6 +54,9 @@ impl Client { port_arg: Option, id: usize, ) -> Result<(Self, UnboundedReceiver)> { + if command == "" { + return Result::Err(Error::Other(anyhow!("Command not provided"))); + } if transport == "tcp" && port_arg.is_some() { Self::tcp_process( &command, @@ -82,6 +94,7 @@ impl Client { thread_id: None, active_frame: None, breakpoints: vec![], + quirks: DebuggerQuirks::default(), }; tokio::spawn(Self::recv(server_rx, client_rx)); diff --git a/helix-dap/src/lib.rs b/helix-dap/src/lib.rs index f60b102c..100c0c60 100644 --- a/helix-dap/src/lib.rs +++ b/helix-dap/src/lib.rs @@ -2,7 +2,7 @@ mod client; mod transport; mod types; -pub use client::Client; +pub use client::{Client, DebuggerQuirks}; pub use events::Event; pub use transport::{Payload, Response, Transport}; pub use types::*; -- cgit v1.2.3-70-g09d2