keymap_ui: Hover tooltip for context (#34290)
Closes #ISSUE Ideally the tooltip would only appear if the context was overflowing it's column, but for now, we just unconditionally show a tooltip so that long contexts can be seen. This PR also includes a change to the tooltip element, allowing for tooltips with non-text contents which is used here for syntax highlighting Release Notes: - N/A *or* Added/Fixed/Improved ... Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
@@ -1015,12 +1015,24 @@ impl Render for KeymapEditor {
|
||||
}
|
||||
}
|
||||
};
|
||||
let context = binding
|
||||
.context
|
||||
.clone()
|
||||
.map_or(gpui::Empty.into_any_element(), |context| {
|
||||
context.into_any_element()
|
||||
});
|
||||
let context = binding.context.clone().map_or(
|
||||
gpui::Empty.into_any_element(),
|
||||
|context| {
|
||||
let is_local = context.local().is_some();
|
||||
|
||||
div()
|
||||
.id(("keymap context", index))
|
||||
.child(context.clone())
|
||||
.when(is_local, |this| {
|
||||
this.tooltip(Tooltip::element({
|
||||
move |_, _| {
|
||||
context.clone().into_any_element()
|
||||
}
|
||||
}))
|
||||
})
|
||||
.into_any_element()
|
||||
},
|
||||
);
|
||||
let source = binding
|
||||
.source
|
||||
.clone()
|
||||
|
||||
Reference in New Issue
Block a user