aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-21 17:33:56 +0000
committerDmitry Sharshakov2021-08-21 17:33:56 +0000
commit26dee49dc991d671fc3cbf7993ff193859edea4e (patch)
tree222075ec05a59080c043923df42bc16cf9d8a8ed
parent462c8a6ec8799ad0dfc9b6643d78ae8372f04945 (diff)
Add command to detach debugger
-rw-r--r--helix-term/src/commands.rs10
-rw-r--r--helix-term/src/keymap.rs1
2 files changed, 11 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 34a146c2..f7317f7a 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -306,6 +306,7 @@ impl Command {
dap_toggle_breakpoint, "Toggle breakpoint",
dap_start, "Start debug session",
dap_run, "Begin program execution",
+ dap_terminate, "End debug session",
suspend, "Suspend"
);
}
@@ -4321,3 +4322,12 @@ fn dap_run(cx: &mut Context) {
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();
+ }
+}
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index 13905bbf..6bb7ca97 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -489,6 +489,7 @@ impl Default for Keymaps {
"s" => dap_start,
"b" => dap_toggle_breakpoint,
"r" => dap_run,
+ "t" => dap_terminate,
},
"w" => { "Window"
"C-w" | "w" => rotate_view,