@@ -4336,12 +4336,33 @@ fn dap_start(cx: &mut Context) {
43364336 use helix_lsp::block_on;
43374337 use serde_json::to_value;
43384338
4339− let (_, _doc) = current!(cx.editor);
4339+ let (_, doc) = current!(cx.editor);
43404340
4341− // look up config for filetype
4342− // if multiple available, open picker
4341+ // TODO config picker
4342+ let path = match doc.path() {
4343+ Some(path) => path.to_path_buf(),
4344+ None => {
4345+ cx.editor
4346+ .set_error("Can't start debug: document has no path".to_string());
4347+ return;
4348+ }
4349+ };
43434350
4344− let started = Client::tcp_process("dlv", vec!["dap"], "-l 127.0.0.1:{}", 0);
4351+ let config = cx
4352+ .editor
4353+ .syn_loader
4354+ .language_config_for_file_name(&path)
4355+ .and_then(|x| x.debug_adapter.clone());
4356+ let config = match config {
4357+ Some(c) => c,
4358+ None => {
4359+ cx.editor.set_error(
4360+ "Can't start debug: no debug adapter available for language".to_string(),
4361+ );
4362+ return;
4363+ }
4364+ };
4365+ let started = Client::tcp_process(config, 0);
43454366 let (mut debugger, events) = block_on(started).unwrap();
43464367
43474368 let request = debugger.initialize("go".to_owned());