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:
parent
10028aaae8
commit
d1a6c5d494
2 changed files with 77 additions and 19 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue