on master help sign in
dap: support stepIn, stepOut, next and pause commands
commitdfc70a12f337df57e69e3613896663c2f446df8e authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateSun 22 Aug 2021, 11:02 (5 years ago) parent2865883
2 files changed+100
helix-dap/src/client.rs+36 helix-dap/src/types.rs+64
helix-dap/src/client.rs+36
@@ -316,4 +316,40 @@ impl Client {
316316 let response = self.request::<requests::Variables>(args).await?;
317317 Ok(response.variables)
318318 }
319+
320+ pub async fn step_in(&mut self, thread_id: usize) -> Result<()> {
321+ let args = requests::StepInArguments {
322+ thread_id,
323+ target_id: None,
324+ granularity: None,
325+ };
326+
327+ self.request::<requests::StepIn>(args).await
328+ }
329+
330+ pub async fn step_out(&mut self, thread_id: usize) -> Result<()> {
331+ let args = requests::StepOutArguments {
332+ thread_id,
333+ granularity: None,
334+ };
335+
336+ self.request::<requests::StepOut>(args).await
337+ }
338+
339+ pub async fn next(&mut self, thread_id: usize) -> Result<()> {
340+ let args = requests::NextArguments {
341+ thread_id,
342+ granularity: None,
343+ };
344+
345+ self.request::<requests::Next>(args).await
346+ }
347+
348+ pub async fn pause(&mut self, thread_id: usize) -> Result<()> {
349+ let args = requests::PauseArguments {
350+ thread_id,
351+ };
352+
353+ self.request::<requests::Pause>(args).await
354+ }
319355}
helix-dap/src/types.rs+64
@@ -420,6 +420,70 @@ pub mod requests {
420420 type Result = VariablesResponse;
421421 const COMMAND: &'static str = "variables";
422422 }
423+
424+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
425+ #[serde(rename_all = "camelCase")]
426+ pub struct StepInArguments {
427+ pub thread_id: usize,
428+ pub target_id: Option<usize>,
429+ pub granularity: Option<String>,
430+ }
431+
432+ #[derive(Debug)]
433+ pub enum StepIn {}
434+
435+ impl Request for StepIn {
436+ type Arguments = StepInArguments;
437+ type Result = ();
438+ const COMMAND: &'static str = "stepIn";
439+ }
440+
441+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
442+ #[serde(rename_all = "camelCase")]
443+ pub struct StepOutArguments {
444+ pub thread_id: usize,
445+ pub granularity: Option<String>,
446+ }
447+
448+ #[derive(Debug)]
449+ pub enum StepOut {}
450+
451+ impl Request for StepOut {
452+ type Arguments = StepOutArguments;
453+ type Result = ();
454+ const COMMAND: &'static str = "stepOut";
455+ }
456+
457+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
458+ #[serde(rename_all = "camelCase")]
459+ pub struct NextArguments {
460+ pub thread_id: usize,
461+ pub granularity: Option<String>,
462+ }
463+
464+ #[derive(Debug)]
465+ pub enum Next {}
466+
467+ impl Request for Next {
468+ type Arguments = NextArguments;
469+ type Result = ();
470+ const COMMAND: &'static str = "next";
471+ }
472+
473+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
474+ #[serde(rename_all = "camelCase")]
475+ pub struct PauseArguments {
476+ pub thread_id: usize,
477+ }
478+
479+ #[derive(Debug)]
480+ pub enum Pause {}
481+
482+ impl Request for Pause {
483+ type Arguments = PauseArguments;
484+ type Result = ();
485+ const COMMAND: &'static str = "pause";
486+ }
423487}
424488
425489// Events