aboutsummaryrefslogtreecommitdiff
path: root/helix-dap
diff options
context:
space:
mode:
Diffstat (limited to 'helix-dap')
-rw-r--r--helix-dap/src/client.rs17
-rw-r--r--helix-dap/src/types.rs13
2 files changed, 28 insertions, 2 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs
index f6d8a069..ff727d00 100644
--- a/helix-dap/src/client.rs
+++ b/helix-dap/src/client.rs
@@ -33,6 +33,7 @@ pub struct Client {
server_tx: UnboundedSender<Payload>,
request_counter: AtomicU64,
connection_type: Option<ConnectionType>,
+ starting_request_args: Option<Value>,
pub caps: Option<DebuggerCapabilities>,
// thread_id -> frames
pub stack_frames: HashMap<ThreadId, Vec<StackFrame>>,
@@ -87,6 +88,7 @@ impl Client {
request_counter: AtomicU64::new(0),
caps: None,
connection_type: None,
+ starting_request_args: None,
stack_frames: HashMap::new(),
thread_states: HashMap::new(),
thread_id: None,
@@ -158,6 +160,10 @@ impl Client {
)
}
+ pub fn starting_request_args(&self) -> &Option<Value> {
+ &self.starting_request_args
+ }
+
pub async fn tcp_process(
cmd: &str,
args: Vec<&str>,
@@ -356,14 +362,25 @@ impl Client {
pub fn launch(&mut self, args: serde_json::Value) -> impl Future<Output = Result<Value>> {
self.connection_type = Some(ConnectionType::Launch);
+ self.starting_request_args = Some(args.clone());
self.call::<requests::Launch>(args)
}
pub fn attach(&mut self, args: serde_json::Value) -> impl Future<Output = Result<Value>> {
self.connection_type = Some(ConnectionType::Attach);
+ self.starting_request_args = Some(args.clone());
self.call::<requests::Attach>(args)
}
+ pub fn restart(&self) -> impl Future<Output = Result<Value>> {
+ let args = if let Some(args) = &self.starting_request_args {
+ args.clone()
+ } else {
+ Value::Null
+ };
+ self.call::<requests::Restart>(args)
+ }
+
pub async fn set_breakpoints(
&self,
file: PathBuf,
diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs
index c598790b..bbaf53a6 100644
--- a/helix-dap/src/types.rs
+++ b/helix-dap/src/types.rs
@@ -378,7 +378,7 @@ pub mod requests {
impl Request for Launch {
type Arguments = Value;
- type Result = Value;
+ type Result = ();
const COMMAND: &'static str = "launch";
}
@@ -387,7 +387,7 @@ pub mod requests {
impl Request for Attach {
type Arguments = Value;
- type Result = Value;
+ type Result = ();
const COMMAND: &'static str = "attach";
}
@@ -403,6 +403,15 @@ pub mod requests {
}
#[derive(Debug)]
+ pub enum Restart {}
+
+ impl Request for Restart {
+ type Arguments = Value;
+ type Result = ();
+ const COMMAND: &'static str = "restart";
+ }
+
+ #[derive(Debug)]
pub enum Disconnect {}
impl Request for Disconnect {