Add command to detach debugger

This commit is contained in:
Dmitry Sharshakov 2021-08-21 20:33:56 +03:00
parent 462c8a6ec8
commit 26dee49dc9
No known key found for this signature in database
GPG key ID: 471FD32E15FD8473
2 changed files with 11 additions and 0 deletions

View file

@ -306,6 +306,7 @@ impl Command {
dap_toggle_breakpoint, "Toggle breakpoint", dap_toggle_breakpoint, "Toggle breakpoint",
dap_start, "Start debug session", dap_start, "Start debug session",
dap_run, "Begin program execution", dap_run, "Begin program execution",
dap_terminate, "End debug session",
suspend, "Suspend" suspend, "Suspend"
); );
} }
@ -4321,3 +4322,12 @@ fn dap_run(cx: &mut Context) {
let _ = block_on(request).unwrap(); let _ = block_on(request).unwrap();
} }
} }
fn dap_terminate(cx: &mut Context) {
use helix_lsp::block_on;
if let Some(debugger) = &mut cx.editor.debugger {
let request = debugger.disconnect();
let _ = block_on(request).unwrap();
}
}

View file

@ -489,6 +489,7 @@ impl Default for Keymaps {
"s" => dap_start, "s" => dap_start,
"b" => dap_toggle_breakpoint, "b" => dap_toggle_breakpoint,
"r" => dap_run, "r" => dap_run,
"t" => dap_terminate,
}, },
"w" => { "Window" "w" => { "Window"
"C-w" | "w" => rotate_view, "C-w" | "w" => rotate_view,