|
|
@ -1,6 +1,7 @@
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
commands,
|
|
|
|
commands,
|
|
|
|
compositor::{Component, Context, EventResult},
|
|
|
|
compositor::{Component, Compositor, Context, EventResult},
|
|
|
|
|
|
|
|
job::Callback,
|
|
|
|
key,
|
|
|
|
key,
|
|
|
|
keymap::{KeymapResult, Keymaps},
|
|
|
|
keymap::{KeymapResult, Keymaps},
|
|
|
|
ui::{Completion, ProgressSpinners},
|
|
|
|
ui::{Completion, ProgressSpinners},
|
|
|
@ -709,12 +710,11 @@ impl EditorView {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn request_parameter(
|
|
|
|
fn debug_parameter_prompt(
|
|
|
|
completions: Vec<String>,
|
|
|
|
completions: Vec<String>,
|
|
|
|
config_name: String,
|
|
|
|
config_name: String,
|
|
|
|
cxt: &mut commands::Context,
|
|
|
|
|
|
|
|
mut params: Vec<String>,
|
|
|
|
mut params: Vec<String>,
|
|
|
|
) {
|
|
|
|
) -> Prompt {
|
|
|
|
let noop = |_input: &str| Vec::new();
|
|
|
|
let noop = |_input: &str| Vec::new();
|
|
|
|
let completer = match completions.get(0).map(|x| x.as_str()) {
|
|
|
|
let completer = match completions.get(0).map(|x| x.as_str()) {
|
|
|
|
Some("filename") => super::completers::filename,
|
|
|
|
Some("filename") => super::completers::filename,
|
|
|
@ -725,7 +725,7 @@ impl EditorView {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
None => noop,
|
|
|
|
None => noop,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let prompt = Prompt::new(
|
|
|
|
Prompt::new(
|
|
|
|
"arg: ".to_owned(),
|
|
|
|
"arg: ".to_owned(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
completer,
|
|
|
|
completer,
|
|
|
@ -737,13 +737,19 @@ impl EditorView {
|
|
|
|
params.push(input.to_owned());
|
|
|
|
params.push(input.to_owned());
|
|
|
|
|
|
|
|
|
|
|
|
if params.len() < completions.len() {
|
|
|
|
if params.len() < completions.len() {
|
|
|
|
todo!();
|
|
|
|
let completions = completions.clone();
|
|
|
|
// Self::request_parameter(
|
|
|
|
let config_name = config_name.clone();
|
|
|
|
// completions.clone(),
|
|
|
|
let params = params.clone();
|
|
|
|
// config_name.clone(),
|
|
|
|
let callback = Box::pin(async move {
|
|
|
|
// cxt,
|
|
|
|
let call: Callback =
|
|
|
|
// params.clone(),
|
|
|
|
Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
|
|
|
|
// );
|
|
|
|
let prompt =
|
|
|
|
|
|
|
|
Self::debug_parameter_prompt(completions, config_name, params);
|
|
|
|
|
|
|
|
compositor.push(Box::new(prompt));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
Ok(call)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
cx.jobs.callback(callback);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
commands::dap_start_impl(
|
|
|
|
commands::dap_start_impl(
|
|
|
|
cx.editor,
|
|
|
|
cx.editor,
|
|
|
@ -753,8 +759,7 @@ impl EditorView {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
)
|
|
|
|
cxt.push_layer(Box::new(prompt));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Handle events by looking them up in `self.keymaps`. Returns None
|
|
|
|
/// Handle events by looking them up in `self.keymaps`. Returns None
|
|
|
@ -785,7 +790,8 @@ impl EditorView {
|
|
|
|
let completions = cxt.editor.debug_config_completions.clone().unwrap();
|
|
|
|
let completions = cxt.editor.debug_config_completions.clone().unwrap();
|
|
|
|
let completion = completions.get(i).unwrap().clone();
|
|
|
|
let completion = completions.get(i).unwrap().clone();
|
|
|
|
if !completion.is_empty() {
|
|
|
|
if !completion.is_empty() {
|
|
|
|
Self::request_parameter(completion, name, cxt, Vec::new());
|
|
|
|
let prompt = Self::debug_parameter_prompt(completion, name, Vec::new());
|
|
|
|
|
|
|
|
cxt.push_layer(Box::new(prompt));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => return None,
|
|
|
|
_ => return None,
|
|
|
|