summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs28
-rw-r--r--helix-term/src/keymap.rs3
2 files changed, 12 insertions, 19 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 35e1c406..0b222a2a 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -303,8 +303,7 @@ impl Command {
select_textobject_around, "Select around object",
select_textobject_inner, "Select inside object",
dap_toggle_breakpoint, "Toggle breakpoint",
- dap_init, "Start debug session",
- dap_launch, "Launch debugger",
+ dap_start, "Start debug session",
dap_run, "Begin program execution",
suspend, "Suspend"
);
@@ -4245,9 +4244,11 @@ fn suspend(_cx: &mut Context) {
}
// DAP
-fn dap_init(cx: &mut Context) {
+fn dap_start(cx: &mut Context) {
use helix_dap::Client;
use helix_lsp::block_on;
+ use serde_json::to_value;
+
let (_, _doc) = current!(cx.editor);
// look up config for filetype
@@ -4259,6 +4260,13 @@ fn dap_init(cx: &mut Context) {
let request = debugger.initialize("go".to_owned());
let _ = block_on(request).unwrap();
+ let mut args = HashMap::new();
+ args.insert("mode", "debug");
+ args.insert("program", "main.go");
+
+ let request = debugger.launch(to_value(args).unwrap());
+ let _ = block_on(request).unwrap();
+
// TODO: either await "initialized" or buffer commands until event is received
cx.editor.debugger = Some(debugger);
@@ -4303,20 +4311,6 @@ fn dap_toggle_breakpoint(cx: &mut Context) {
}
}
-fn dap_launch(cx: &mut Context) {
- use helix_lsp::block_on;
- use serde_json::to_value;
-
- if let Some(debugger) = &mut cx.editor.debugger {
- let mut args = HashMap::new();
- args.insert("mode", "debug");
- args.insert("program", "main.go");
-
- let request = debugger.launch(to_value(args).unwrap());
- let _ = block_on(request).unwrap();
- }
-}
-
fn dap_run(cx: &mut Context) {
use helix_lsp::block_on;
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index 3318a607..13905bbf 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -486,8 +486,7 @@ impl Default for Keymaps {
"a" => code_action,
"'" => last_picker,
"d" => { "Debug"
- "i" => dap_init,
- "s" => dap_launch,
+ "s" => dap_start,
"b" => dap_toggle_breakpoint,
"r" => dap_run,
},