aboutsummaryrefslogtreecommitdiff
path: root/helix-dap
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-09-26 18:36:06 +0000
committerDmitry Sharshakov2021-09-26 18:36:06 +0000
commitd943a51e3e8e2cd77cc336c30eb954378e81fe31 (patch)
tree6a6cc9d6bc58669045806bf04fbe77b18aa58527 /helix-dap
parent0e51e5fbaf6eeffa25b8660b96f2486174671492 (diff)
editor: add Node.js debugger
Diffstat (limited to 'helix-dap')
-rw-r--r--helix-dap/src/client.rs13
-rw-r--r--helix-dap/src/lib.rs2
2 files changed, 14 insertions, 1 deletions
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<usize>,
pub breakpoints: Vec<Breakpoint>,
+ pub quirks: DebuggerQuirks,
}
impl Client {
@@ -45,6 +54,9 @@ impl Client {
port_arg: Option<String>,
id: usize,
) -> Result<(Self, UnboundedReceiver<Payload>)> {
+ 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::*;