From 0e51e5fbaf6eeffa25b8660b96f2486174671492 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sun, 26 Sep 2021 10:24:58 +0300 Subject: editor: support setExceptionBreakpoints --- helix-dap/src/client.rs | 13 +++++++++++++ helix-dap/src/types.rs | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'helix-dap') diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 2ae82422..8dd41868 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -399,4 +399,17 @@ impl Client { self.request::(args).await } + + pub async fn set_exception_breakpoints( + &mut self, + filters: Vec, + ) -> Result>> { + let args = requests::SetExceptionBreakpointsArguments { filters }; + + let response = self + .request::(args) + .await; + + Ok(response.ok().map(|r| r.breakpoints).unwrap_or_default()) + } } diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index 3af29922..5430771f 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -515,6 +515,29 @@ pub mod requests { type Result = EvaluateResponse; const COMMAND: &'static str = "evaluate"; } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct SetExceptionBreakpointsArguments { + pub filters: Vec, + // pub filterOptions: Option>, // needs capability + // pub exceptionOptions: Option>, // needs capability + } + + #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct SetExceptionBreakpointsResponse { + pub breakpoints: Option>, + } + + #[derive(Debug)] + pub enum SetExceptionBreakpoints {} + + impl Request for SetExceptionBreakpoints { + type Arguments = SetExceptionBreakpointsArguments; + type Result = SetExceptionBreakpointsResponse; + const COMMAND: &'static str = "setExceptionBreakpoints"; + } } // Events -- cgit v1.2.3-70-g09d2