Show keybindings instead of the action names in the recent project modal
This commit is contained in:
parent
c29ea9bdbc
commit
16d826a3f4
1 changed files with 18 additions and 4 deletions
|
@ -146,11 +146,25 @@ impl EventEmitter<DismissEvent> for RecentProjectsDelegate {}
|
||||||
impl PickerDelegate for RecentProjectsDelegate {
|
impl PickerDelegate for RecentProjectsDelegate {
|
||||||
type ListItem = ListItem;
|
type ListItem = ListItem;
|
||||||
|
|
||||||
fn placeholder_text(&self, _cx: &mut WindowContext) -> Arc<str> {
|
fn placeholder_text(&self, cx: &mut WindowContext) -> Arc<str> {
|
||||||
|
let action_binding_text = |action: &dyn gpui::Action| {
|
||||||
|
cx.bindings_for_action(action)
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.map(|binding| {
|
||||||
|
binding
|
||||||
|
.keystrokes()
|
||||||
|
.into_iter()
|
||||||
|
.map(ToString::to_string)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(" ")
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| format!("{action:?}"))
|
||||||
|
};
|
||||||
Arc::from(format!(
|
Arc::from(format!(
|
||||||
"`{:?}` reuses the window, `{:?}` opens in new",
|
"{} reuses the window, {} opens a new one",
|
||||||
menu::Confirm,
|
action_binding_text(&menu::Confirm),
|
||||||
menu::SecondaryConfirm,
|
action_binding_text(&menu::SecondaryConfirm),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue