|
|
@ -303,8 +303,7 @@ impl Command {
|
|
|
|
select_textobject_around, "Select around object",
|
|
|
|
select_textobject_around, "Select around object",
|
|
|
|
select_textobject_inner, "Select inside object",
|
|
|
|
select_textobject_inner, "Select inside object",
|
|
|
|
dap_toggle_breakpoint, "Toggle breakpoint",
|
|
|
|
dap_toggle_breakpoint, "Toggle breakpoint",
|
|
|
|
dap_init, "Start debug session",
|
|
|
|
dap_start, "Start debug session",
|
|
|
|
dap_launch, "Launch debugger",
|
|
|
|
|
|
|
|
dap_run, "Begin program execution",
|
|
|
|
dap_run, "Begin program execution",
|
|
|
|
suspend, "Suspend"
|
|
|
|
suspend, "Suspend"
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -4245,9 +4244,11 @@ fn suspend(_cx: &mut Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DAP
|
|
|
|
// DAP
|
|
|
|
fn dap_init(cx: &mut Context) {
|
|
|
|
fn dap_start(cx: &mut Context) {
|
|
|
|
use helix_dap::Client;
|
|
|
|
use helix_dap::Client;
|
|
|
|
use helix_lsp::block_on;
|
|
|
|
use helix_lsp::block_on;
|
|
|
|
|
|
|
|
use serde_json::to_value;
|
|
|
|
|
|
|
|
|
|
|
|
let (_, _doc) = current!(cx.editor);
|
|
|
|
let (_, _doc) = current!(cx.editor);
|
|
|
|
|
|
|
|
|
|
|
|
// look up config for filetype
|
|
|
|
// look up config for filetype
|
|
|
@ -4259,6 +4260,13 @@ fn dap_init(cx: &mut Context) {
|
|
|
|
let request = debugger.initialize("go".to_owned());
|
|
|
|
let request = debugger.initialize("go".to_owned());
|
|
|
|
let _ = block_on(request).unwrap();
|
|
|
|
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
|
|
|
|
// TODO: either await "initialized" or buffer commands until event is received
|
|
|
|
|
|
|
|
|
|
|
|
cx.editor.debugger = Some(debugger);
|
|
|
|
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) {
|
|
|
|
fn dap_run(cx: &mut Context) {
|
|
|
|
use helix_lsp::block_on;
|
|
|
|
use helix_lsp::block_on;
|
|
|
|
|
|
|
|
|
|
|
|