diff options
author | Blaž Hrastnik | 2021-09-03 04:02:09 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-09-03 04:26:30 +0000 |
commit | b997d2cdeb3abd62fdd3c809a69478bbdef8642e (patch) | |
tree | d99dec73aa5cfe4fcb95a13d798c5f43d28aa488 /helix-term/src/commands | |
parent | 289303a30d8518890ae708b7fdd4996830df8642 (diff) |
dap: Allow setting breakpoints before starting the adapter
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/dap.rs | 11 |
1 files changed, 5 insertions, 6 deletions
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 |