@@ -4336,12 +4336,33 @@ fn dap_start(cx: &mut Context) {
4336 use helix_lsp::block_on;
4336 use helix_lsp::block_on;
4337 use serde_json::to_value;
4337 use serde_json::to_value;
4339− let (_, _doc) = current!(cx.editor);
4339+ let (_, doc) = current!(cx.editor);
4341− // look up config for filetype
4341+ // TODO config picker
4342− // if multiple available, open picker
4342+ let path = match doc.path() {
4343+ Some(path) => path.to_path_buf(),
4346+ .set_error("Can't start debug: document has no path".to_string());
4354+ .language_config_for_file_name(&path)
4355+ .and_then(|x| x.debug_adapter.clone());
4356+ let config = match config {
4359+ cx.editor.set_error(
4360+ "Can't start debug: no debug adapter available for language".to_string(),
4344− let started = Client::tcp_process("dlv", vec!["dap"], "-l 127.0.0.1:{}", 0);
4365+ let started = Client::tcp_process(config, 0);
4345 let (mut debugger, events) = block_on(started).unwrap();
4366 let (mut debugger, events) = block_on(started).unwrap();
4347 let request = debugger.initialize("go".to_owned());
4368 let request = debugger.initialize("go".to_owned());