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-term/src/commands/dap.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 3fb990c2..65a0d33f 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -513,6 +513,39 @@ pub fn dap_terminate(cx: &mut Context) { cx.editor.debugger = None; } +pub fn dap_enable_exceptions(cx: &mut Context) { + let debugger = match &mut cx.editor.debugger { + Some(debugger) => debugger, + None => return, + }; + + let filters = match &debugger.capabilities().exception_breakpoint_filters { + Some(filters) => filters.clone(), + None => return, + }; + + if let Err(e) = block_on( + debugger.set_exception_breakpoints(filters.iter().map(|f| f.filter.clone()).collect()), + ) { + cx.editor + .set_error(format!("Failed to set up exception breakpoints: {:?}", e)); + return; + } +} + +pub fn dap_disable_exceptions(cx: &mut Context) { + let debugger = match &mut cx.editor.debugger { + Some(debugger) => debugger, + None => return, + }; + + if let Err(e) = block_on(debugger.set_exception_breakpoints(vec![])) { + cx.editor + .set_error(format!("Failed to set up exception breakpoints: {:?}", e)); + return; + } +} + pub fn dap_edit_condition(cx: &mut Context) { if let Some((pos, mut bp)) = commands::cmd::get_breakpoint_at_current_line(cx.editor) { let callback = Box::pin(async move { -- cgit v1.2.3-70-g09d2