|
|
@ -340,6 +340,7 @@ impl MappableCommand {
|
|
|
|
code_action, "Perform code action",
|
|
|
|
code_action, "Perform code action",
|
|
|
|
buffer_picker, "Open buffer picker",
|
|
|
|
buffer_picker, "Open buffer picker",
|
|
|
|
jumplist_picker, "Open jumplist picker",
|
|
|
|
jumplist_picker, "Open jumplist picker",
|
|
|
|
|
|
|
|
command_history_picker, "Open command history picker",
|
|
|
|
symbol_picker, "Open symbol picker",
|
|
|
|
symbol_picker, "Open symbol picker",
|
|
|
|
changed_file_picker, "Open changed file picker",
|
|
|
|
changed_file_picker, "Open changed file picker",
|
|
|
|
select_references_to_symbol_under_cursor, "Select symbol references",
|
|
|
|
select_references_to_symbol_under_cursor, "Select symbol references",
|
|
|
@ -2926,6 +2927,42 @@ fn buffer_picker(cx: &mut Context) {
|
|
|
|
cx.push_layer(Box::new(overlaid(picker)));
|
|
|
|
cx.push_layer(Box::new(overlaid(picker)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn command_history_picker(cx: &mut Context) {
|
|
|
|
|
|
|
|
let command_history = cx.editor.registers.read(':', cx.editor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let items: Vec<Command> = command_history
|
|
|
|
|
|
|
|
.into_iter()
|
|
|
|
|
|
|
|
.flatten()
|
|
|
|
|
|
|
|
.map(|entry| Command {
|
|
|
|
|
|
|
|
args: entry.to_string(),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Command {
|
|
|
|
|
|
|
|
args: String,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let columns = [PickerColumn::new("command", |command: &Command, _| {
|
|
|
|
|
|
|
|
format!(":{}", command.args).into()
|
|
|
|
|
|
|
|
})];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let picker = Picker::new(columns, 0, items, (), |cx, option, _action| {
|
|
|
|
|
|
|
|
let args = option.args.clone();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cx.jobs.callback(async move {
|
|
|
|
|
|
|
|
let callback = |editor: &mut Editor, compositor: &mut Compositor| {
|
|
|
|
|
|
|
|
let prompt = command_mode_prompt().with_line(args, editor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compositor.push(Box::new(prompt));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(Callback::EditorCompositor(Box::new(callback)))
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cx.push_layer(Box::new(overlaid(picker)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn jumplist_picker(cx: &mut Context) {
|
|
|
|
fn jumplist_picker(cx: &mut Context) {
|
|
|
|
struct JumpMeta {
|
|
|
|
struct JumpMeta {
|
|
|
|
id: DocumentId,
|
|
|
|
id: DocumentId,
|
|
|
|