Expose active key equivalents in the keymap context view (#20530)
Release Notes: - Added macOS key equivalents to cmd-shift-p `debug: Open Key Context View`
This commit is contained in:
parent
e4bf586cff
commit
ad3171d16d
2 changed files with 15 additions and 0 deletions
|
@ -4,6 +4,7 @@ use gpui::{
|
|||
};
|
||||
use itertools::Itertools;
|
||||
use serde_json::json;
|
||||
use settings::get_key_equivalents;
|
||||
use ui::{
|
||||
div, h_flex, px, v_flex, ButtonCommon, Clickable, FluentBuilder, InteractiveElement, Label,
|
||||
LabelCommon, LabelSize, ParentElement, SharedString, StatefulInteractiveElement, Styled,
|
||||
|
@ -167,6 +168,7 @@ impl Item for KeyContextView {
|
|||
impl Render for KeyContextView {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl ui::IntoElement {
|
||||
use itertools::Itertools;
|
||||
let key_equivalents = get_key_equivalents(cx.keyboard_layout());
|
||||
v_flex()
|
||||
.id("key-context-view")
|
||||
.overflow_scroll()
|
||||
|
@ -276,5 +278,17 @@ impl Render for KeyContextView {
|
|||
}),
|
||||
)
|
||||
})
|
||||
.when_some(key_equivalents, |el, key_equivalents| {
|
||||
el.child(Label::new("Key Equivalents").mt_4().size(LabelSize::Large))
|
||||
.child(Label::new("Shortcuts defined using some characters have been remapped so that shortcuts can be typed without holding option."))
|
||||
.children(
|
||||
key_equivalents
|
||||
.iter()
|
||||
.sorted()
|
||||
.map(|(key, equivalent)| {
|
||||
Label::new(format!("cmd-{} => cmd-{}", key, equivalent)).ml_8()
|
||||
}),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use util::asset_str;
|
|||
|
||||
pub use editable_setting_control::*;
|
||||
pub use json_schema::*;
|
||||
pub use key_equivalents::*;
|
||||
pub use keymap_file::KeymapFile;
|
||||
pub use settings_file::*;
|
||||
pub use settings_store::{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue