aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-23 13:56:41 +0000
committerDmitry Sharshakov2021-08-23 13:56:41 +0000
commitf55a012fb744b258ac84ac0302cb0b87f7d35173 (patch)
tree4a4b91f4ff9cabf5cc5da5f8f7426cc21d9af7c2 /helix-term
parentc5b210df59983a2caa9c389e5cd22aa670fb4a00 (diff)
editor: add debug session config
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 3b8e1022..9ecc5bfe 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -4368,9 +4368,24 @@ fn dap_start(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 sessions = cx
+ .editor
+ .syn_loader
+ .language_config_for_file_name(&path)
+ .and_then(|x| x.debug_configs.clone());
+
+ let sessions = match sessions {
+ Some(c) => c,
+ None => {
+ cx.editor.set_error(
+ "Can't start debug: no debug sessions available for language".to_string(),
+ );
+ return;
+ }
+ };
+
+ // TODO: picker
+ let args = sessions.get(0);
let request = debugger.launch(to_value(args).unwrap());
let _ = block_on(request).unwrap();