@@ -165,19 +165,10 @@ pub fn dap_start_impl(
165 socket: Option<std::net::SocketAddr>,
165 socket: Option<std::net::SocketAddr>,
166 params: Option<Vec<&str>>,
166 params: Option<Vec<&str>>,
168− let (_, doc) = current!(editor);
168+ let doc = doc!(editor);
170− let path = match doc.path() {
170+ let config = match doc
173− editor.set_error("Can't start debug: document has no path".to_string());
178− let language_config = editor.syn_loader.language_config_for_file_name(path);
179− let config = match language_config
171+ .language_config()
181 .and_then(|config| config.debugger.as_ref())
172 .and_then(|config| config.debugger.as_ref())
183 Some(c) => c,
174 Some(c) => c,
@@ -283,7 +274,8 @@ pub fn dap_start_impl(
285 if let Err(e) = result {
276 if let Err(e) = result {
286− editor.set_error(format!("Failed {} target: {}", start_config.request, e));
277+ let msg = format!("Failed {} target: {}", start_config.request, e);
278+ editor.set_error(msg);
@@ -300,19 +292,10 @@ pub fn dap_launch(cx: &mut Context) {
303− let (_, doc) = current!(cx.editor);
295+ let doc = doc!(cx.editor);
304− let path = match doc.path() {
308− .set_error("Can't start debug: document has no path".to_string());
313− let language_config = cx.editor.syn_loader.language_config_for_file_name(path);
314− let config = match language_config
297+ let config = match doc
315− .as_deref()
298+ .language_config()
316 .and_then(|config| config.debugger.as_ref())
299 .and_then(|config| config.debugger.as_ref())
318 Some(c) => c,
301 Some(c) => c,
@@ -324,9 +307,11 @@ pub fn dap_launch(cx: &mut Context) {
310+ let templates = config.templates.clone();
327 cx.push_layer(Box::new(Picker::new(
312 cx.push_layer(Box::new(Picker::new(
329− config.templates.clone(),
314+ templates,
330 |template| template.name.as_str().into(),
315 |template| template.name.as_str().into(),
331 |cx, template, _action| {
316 |cx, template, _action| {
332 let completions = template.completion.clone();
317 let completions = template.completion.clone();