summaryrefslogtreecommitdiff
path: root/helix-term/src/commands
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-09-26 07:24:58 +0000
committerDmitry Sharshakov2021-09-26 07:24:58 +0000
commit0e51e5fbaf6eeffa25b8660b96f2486174671492 (patch)
treea76212d795705f3af039ff6de409bf5ec98be856 /helix-term/src/commands
parentbf53aff27d2d90b41bab01f4d628f0bd9fbcd589 (diff)
editor: support setExceptionBreakpoints
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r--helix-term/src/commands/dap.rs33
1 files changed, 33 insertions, 0 deletions
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 {