|
|
@ -118,11 +118,14 @@ fn dap_callback<T, F>(
|
|
|
|
let callback = Box::pin(async move {
|
|
|
|
let callback = Box::pin(async move {
|
|
|
|
let json = call.await?;
|
|
|
|
let json = call.await?;
|
|
|
|
let response = serde_json::from_value(json)?;
|
|
|
|
let response = serde_json::from_value(json)?;
|
|
|
|
let call: Callback = Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
|
|
|
|
let call: Callback = Callback::EditorCompositor(Box::new(
|
|
|
|
|
|
|
|
move |editor: &mut Editor, compositor: &mut Compositor| {
|
|
|
|
callback(editor, compositor, response)
|
|
|
|
callback(editor, compositor, response)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
));
|
|
|
|
Ok(call)
|
|
|
|
Ok(call)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
jobs.callback(callback);
|
|
|
|
jobs.callback(callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -274,10 +277,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 = Box::new(move |_editor, compositor| {
|
|
|
|
let call: Callback = Callback::Compositor(Box::new(move |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);
|
|
|
@ -332,10 +335,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 = Box::new(move |_editor, compositor| {
|
|
|
|
let call: Callback = Callback::Compositor(Box::new(move |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);
|
|
|
@ -582,7 +585,7 @@ 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 = Box::new(move |editor, compositor| {
|
|
|
|
let call: Callback = Callback::EditorCompositor(Box::new(move |editor, compositor| {
|
|
|
|
let mut prompt = Prompt::new(
|
|
|
|
let mut prompt = Prompt::new(
|
|
|
|
"condition:".into(),
|
|
|
|
"condition:".into(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
@ -610,7 +613,7 @@ pub fn dap_edit_condition(cx: &mut Context) {
|
|
|
|
prompt.insert_str(&condition, editor)
|
|
|
|
prompt.insert_str(&condition, editor)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compositor.push(Box::new(prompt));
|
|
|
|
compositor.push(Box::new(prompt));
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
Ok(call)
|
|
|
|
Ok(call)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
cx.jobs.callback(callback);
|
|
|
|
cx.jobs.callback(callback);
|
|
|
@ -624,7 +627,7 @@ 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 = Box::new(move |editor, compositor| {
|
|
|
|
let call: Callback = Callback::EditorCompositor(Box::new(move |editor, compositor| {
|
|
|
|
let mut prompt = Prompt::new(
|
|
|
|
let mut prompt = Prompt::new(
|
|
|
|
"log-message:".into(),
|
|
|
|
"log-message:".into(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
@ -651,7 +654,7 @@ pub fn dap_edit_log(cx: &mut Context) {
|
|
|
|
prompt.insert_str(&log_message, editor);
|
|
|
|
prompt.insert_str(&log_message, editor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compositor.push(Box::new(prompt));
|
|
|
|
compositor.push(Box::new(prompt));
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
Ok(call)
|
|
|
|
Ok(call)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
cx.jobs.callback(callback);
|
|
|
|
cx.jobs.callback(callback);
|
|
|
|