From b997d2cdeb3abd62fdd3c809a69478bbdef8642e Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 3 Sep 2021 13:02:09 +0900 Subject: dap: Allow setting breakpoints before starting the adapter --- helix-term/src/commands/dap.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 7618fca2..5c415ca4 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -279,12 +279,7 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) { // TODO: need to map breakpoints over edits and update them? // we shouldn't really allow editing while debug is running though - let debugger = match &mut cx.editor.debugger { - Some(debugger) => debugger, - None => return, - }; - - let breakpoints = debugger.breakpoints.entry(path.clone()).or_default(); + let breakpoints = cx.editor.breakpoints.entry(path.clone()).or_default(); if let Some(pos) = breakpoints.iter().position(|b| b.line == breakpoint.line) { breakpoints.remove(pos); } else { @@ -293,6 +288,10 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) { let breakpoints = breakpoints.clone(); + let debugger = match &mut cx.editor.debugger { + Some(debugger) => debugger, + None => return, + }; let request = debugger.set_breakpoints(path, breakpoints); if let Err(e) = block_on(request) { cx.editor -- cgit v1.2.3-70-g09d2