on master help sign in
Strip some more params
20cf75dBlaž Hrastnik
helix-term/src/commands/dap.rs+66−74
@@ -30,9 +30,7 @@ fn thread_picker(
30 dap_callback(
30 dap_callback(
31 cx.jobs,
31 cx.jobs,
32 future,
32 future,
33− move |editor: &mut Editor,
34− compositor: &mut Compositor,
35− response: dap::requests::ThreadsResponse| {
33+ move |editor, compositor, response: dap::requests::ThreadsResponse| {
36 let threads = response.threads;
34 let threads = response.threads;
37 if threads.len() == 1 {
35 if threads.len() == 1 {
38 callback_fn(editor, &threads[0]);
36 callback_fn(editor, &threads[0]);
@@ -250,11 +248,10 @@ pub fn dap_launch(cx: &mut Context) {
250 let completions = template.completion.clone();
248 let completions = template.completion.clone();
251 let name = template.name.clone();
249 let name = template.name.clone();
252 let callback = Box::pin(async move {
250 let callback = Box::pin(async move {
253− let call: Callback =
254− Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
251+ let call: Callback = Box::new(move |_editor, compositor| {
255− let prompt = debug_parameter_prompt(completions, name, Vec::new());
252+ let prompt = debug_parameter_prompt(completions, name, Vec::new());
256− compositor.push(Box::new(prompt));
253+ compositor.push(Box::new(prompt));
257− });
254+ });
258 Ok(call)
255 Ok(call)
259 });
256 });
260 cx.jobs.callback(callback);
257 cx.jobs.callback(callback);
@@ -309,11 +306,10 @@ fn debug_parameter_prompt(
309 let config_name = config_name.clone();
306 let config_name = config_name.clone();
310 let params = params.clone();
307 let params = params.clone();
311 let callback = Box::pin(async move {
308 let callback = Box::pin(async move {
312− let call: Callback =
313− Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
309+ let call: Callback = Box::new(move |_editor, compositor| {
314− let prompt = debug_parameter_prompt(completions, config_name, params);
310+ let prompt = debug_parameter_prompt(completions, config_name, params);
315− compositor.push(Box::new(prompt));
311+ compositor.push(Box::new(prompt));
316− });
312+ });
317 Ok(call)
313 Ok(call)
318 });
314 });
319 cx.jobs.callback(callback);
315 cx.jobs.callback(callback);
@@ -560,37 +556,35 @@ pub fn dap_edit_condition(cx: &mut Context) {
560 None => return,
556 None => return,
561 };
557 };
562 let callback = Box::pin(async move {
558 let callback = Box::pin(async move {
563− let call: Callback =
564− Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
559+ let call: Callback = Box::new(move |_editor, compositor| {
565− let mut prompt = Prompt::new(
560+ let mut prompt = Prompt::new(
566− "condition:".into(),
561+ "condition:".into(),
567− None,
562+ None,
568− ui::completers::none,
563+ ui::completers::none,
569− move |cx, input: &str, event: PromptEvent| {
564+ move |cx, input: &str, event: PromptEvent| {
570− if event != PromptEvent::Validate {
565+ if event != PromptEvent::Validate {
571− return;
566+ return;
572− }
567+ }
573−
568+
574− let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap();
569+ let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap();
575− breakpoints[pos].condition = match input {
570+ breakpoints[pos].condition = match input {
576− "" => None,
571+ "" => None,
577− input => Some(input.to_owned()),
572+ input => Some(input.to_owned()),
578− };
573+ };
579−
574+
580− let debugger = debugger!(cx.editor);
575+ let debugger = debugger!(cx.editor);
581−
576+
582− if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints)
577+ if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints) {
583− {
584− cx.editor
578+ cx.editor
585− .set_error(format!("Failed to set breakpoints: {}", e));
579+ .set_error(format!("Failed to set breakpoints: {}", e));
586− }
580+ }
587− },
581+ },
588− );
582+ );
589− if let Some(condition) = breakpoint.condition {
583+ if let Some(condition) = breakpoint.condition {
590− prompt.insert_str(&condition)
584+ prompt.insert_str(&condition)
591− }
585+ }
592− compositor.push(Box::new(prompt));
586+ compositor.push(Box::new(prompt));
593− });
587+ });
594 Ok(call)
588 Ok(call)
595 });
589 });
596 cx.jobs.callback(callback);
590 cx.jobs.callback(callback);
@@ -604,36 +598,34 @@ pub fn dap_edit_log(cx: &mut Context) {
604 None => return,
598 None => return,
605 };
599 };
606 let callback = Box::pin(async move {
600 let callback = Box::pin(async move {
607− let call: Callback =
608− Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
601+ let call: Callback = Box::new(move |_editor, compositor| {
609− let mut prompt = Prompt::new(
602+ let mut prompt = Prompt::new(
610− "log-message:".into(),
603+ "log-message:".into(),
611− None,
604+ None,
612− ui::completers::none,
605+ ui::completers::none,
613− move |cx, input: &str, event: PromptEvent| {
606+ move |cx, input: &str, event: PromptEvent| {
614− if event != PromptEvent::Validate {
607+ if event != PromptEvent::Validate {
615− return;
608+ return;
616− }
609+ }
617−
610+
618− let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap();
611+ let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap();
619− breakpoints[pos].log_message = match input {
612+ breakpoints[pos].log_message = match input {
620− "" => None,
613+ "" => None,
621− input => Some(input.to_owned()),
614+ input => Some(input.to_owned()),
622− };
615+ };
623−
616+
624− let debugger = debugger!(cx.editor);
617+ let debugger = debugger!(cx.editor);
625− if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints)
618+ if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints) {
626− {
627− cx.editor
619+ cx.editor
628− .set_error(format!("Failed to set breakpoints: {}", e));
620+ .set_error(format!("Failed to set breakpoints: {}", e));
629− }
621+ }
630− },
622+ },
631− );
623+ );
632− if let Some(log_message) = breakpoint.log_message {
624+ if let Some(log_message) = breakpoint.log_message {
633− prompt.insert_str(&log_message);
625+ prompt.insert_str(&log_message);
634− }
626+ }
635− compositor.push(Box::new(prompt));
627+ compositor.push(Box::new(prompt));
636− });
628+ });
637 Ok(call)
629 Ok(call)
638 });
630 });
639 cx.jobs.callback(callback);
631 cx.jobs.callback(callback);