Strip some more params

pull/1872/head
Blaž Hrastnik 3 years ago
parent 1849ad1fde
commit 20cf75dfa1
No known key found for this signature in database
GPG Key ID: 1238B9C4AD889640

@ -30,9 +30,7 @@ fn thread_picker(
dap_callback( dap_callback(
cx.jobs, cx.jobs,
future, future,
move |editor: &mut Editor, move |editor, compositor, response: dap::requests::ThreadsResponse| {
compositor: &mut Compositor,
response: dap::requests::ThreadsResponse| {
let threads = response.threads; let threads = response.threads;
if threads.len() == 1 { if threads.len() == 1 {
callback_fn(editor, &threads[0]); callback_fn(editor, &threads[0]);
@ -250,11 +248,10 @@ pub fn dap_launch(cx: &mut Context) {
let completions = template.completion.clone(); let completions = template.completion.clone();
let name = template.name.clone(); let name = template.name.clone();
let callback = Box::pin(async move { let callback = Box::pin(async move {
let call: Callback = let call: Callback = Box::new(move |_editor, compositor| {
Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| { let prompt = debug_parameter_prompt(completions, name, Vec::new());
let prompt = debug_parameter_prompt(completions, name, Vec::new()); compositor.push(Box::new(prompt));
compositor.push(Box::new(prompt)); });
});
Ok(call) Ok(call)
}); });
cx.jobs.callback(callback); cx.jobs.callback(callback);
@ -309,11 +306,10 @@ fn debug_parameter_prompt(
let config_name = config_name.clone(); let config_name = config_name.clone();
let params = params.clone(); let params = params.clone();
let callback = Box::pin(async move { let callback = Box::pin(async move {
let call: Callback = let call: Callback = Box::new(move |_editor, compositor| {
Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| { let prompt = debug_parameter_prompt(completions, config_name, params);
let prompt = debug_parameter_prompt(completions, config_name, params); compositor.push(Box::new(prompt));
compositor.push(Box::new(prompt)); });
});
Ok(call) Ok(call)
}); });
cx.jobs.callback(callback); cx.jobs.callback(callback);
@ -560,37 +556,35 @@ pub fn dap_edit_condition(cx: &mut Context) {
None => return, None => return,
}; };
let callback = Box::pin(async move { let callback = Box::pin(async move {
let call: Callback = let call: Callback = Box::new(move |_editor, compositor| {
Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| { let mut prompt = Prompt::new(
let mut prompt = Prompt::new( "condition:".into(),
"condition:".into(), None,
None, ui::completers::none,
ui::completers::none, move |cx, input: &str, event: PromptEvent| {
move |cx, input: &str, event: PromptEvent| { if event != PromptEvent::Validate {
if event != PromptEvent::Validate { return;
return; }
}
let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap();
let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap(); breakpoints[pos].condition = match input {
breakpoints[pos].condition = match input { "" => None,
"" => None, input => Some(input.to_owned()),
input => Some(input.to_owned()), };
};
let debugger = debugger!(cx.editor);
let debugger = debugger!(cx.editor);
if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints) {
if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints) cx.editor
{ .set_error(format!("Failed to set breakpoints: {}", e));
cx.editor }
.set_error(format!("Failed to set breakpoints: {}", e)); },
} );
}, if let Some(condition) = breakpoint.condition {
); prompt.insert_str(&condition)
if let Some(condition) = breakpoint.condition { }
prompt.insert_str(&condition) compositor.push(Box::new(prompt));
} });
compositor.push(Box::new(prompt));
});
Ok(call) Ok(call)
}); });
cx.jobs.callback(callback); cx.jobs.callback(callback);
@ -604,36 +598,34 @@ pub fn dap_edit_log(cx: &mut Context) {
None => return, None => return,
}; };
let callback = Box::pin(async move { let callback = Box::pin(async move {
let call: Callback = let call: Callback = Box::new(move |_editor, compositor| {
Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| { let mut prompt = Prompt::new(
let mut prompt = Prompt::new( "log-message:".into(),
"log-message:".into(), None,
None, ui::completers::none,
ui::completers::none, move |cx, input: &str, event: PromptEvent| {
move |cx, input: &str, event: PromptEvent| { if event != PromptEvent::Validate {
if event != PromptEvent::Validate { return;
return; }
}
let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap();
let breakpoints = &mut cx.editor.breakpoints.get_mut(&path).unwrap(); breakpoints[pos].log_message = match input {
breakpoints[pos].log_message = match input { "" => None,
"" => None, input => Some(input.to_owned()),
input => Some(input.to_owned()), };
};
let debugger = debugger!(cx.editor);
let debugger = debugger!(cx.editor); if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints) {
if let Err(e) = breakpoints_changed(debugger, path.clone(), breakpoints) cx.editor
{ .set_error(format!("Failed to set breakpoints: {}", e));
cx.editor }
.set_error(format!("Failed to set breakpoints: {}", e)); },
} );
}, if let Some(log_message) = breakpoint.log_message {
); prompt.insert_str(&log_message);
if let Some(log_message) = breakpoint.log_message { }
prompt.insert_str(&log_message); compositor.push(Box::new(prompt));
} });
compositor.push(Box::new(prompt));
});
Ok(call) Ok(call)
}); });
cx.jobs.callback(callback); cx.jobs.callback(callback);

Loading…
Cancel
Save