Fix hover tooltips appearing after related element is pressed (#24540)
Closes https://github.com/zed-industries/zed/issues/23894 Reworks all trigger declarations from `.trigger(element.tooltip(tooltip))` into `.trigger_with_tooltip(element, tooltip)` , with new API disallowing simultaneous trigger and tooltip display. All existing `.trigger(` calls were replaced, except 2 not applicable (in dock.rs and pane.rs), 15 left as ones without tooltips, and 2 unchanged places in `inline_completion_button.rs`, where https://github.com/zed-industries/zed/blob/0f7bb2e9fd6dc1fe3f0127de19df372f75ad0c4f/crates/inline_completion_button/src/inline_completion_button.rs#L311-L319 `with_animation` does not allow us to simply use the same approach. Release Notes: - Fixed hover tooltips appearing after related element is pressed --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
co-authored by
Danilo Leal
parent
1a133ab9d8
commit
6f7f0f30e2
@@ -142,9 +142,12 @@ impl Render for InlineCompletionButton {
|
||||
})
|
||||
})
|
||||
.anchor(Corner::BottomRight)
|
||||
.trigger(IconButton::new("copilot-icon", icon).tooltip(|window, cx| {
|
||||
Tooltip::for_action("GitHub Copilot", &ToggleMenu, window, cx)
|
||||
}))
|
||||
.trigger_with_tooltip(
|
||||
IconButton::new("copilot-icon", icon),
|
||||
|window, cx| {
|
||||
Tooltip::for_action("GitHub Copilot", &ToggleMenu, window, cx)
|
||||
},
|
||||
)
|
||||
.with_handle(self.popover_menu_handle.clone()),
|
||||
)
|
||||
}
|
||||
@@ -211,7 +214,8 @@ impl Render for InlineCompletionButton {
|
||||
_ => None,
|
||||
})
|
||||
.anchor(Corner::BottomRight)
|
||||
.trigger(IconButton::new("supermaven-icon", icon).tooltip(
|
||||
.trigger_with_tooltip(
|
||||
IconButton::new("supermaven-icon", icon),
|
||||
move |window, cx| {
|
||||
if has_menu {
|
||||
Tooltip::for_action(
|
||||
@@ -224,7 +228,7 @@ impl Render for InlineCompletionButton {
|
||||
Tooltip::text(tooltip_text.clone())(window, cx)
|
||||
}
|
||||
},
|
||||
))
|
||||
)
|
||||
.with_handle(self.popover_menu_handle.clone()),
|
||||
);
|
||||
}
|
||||
@@ -287,31 +291,6 @@ impl Render for InlineCompletionButton {
|
||||
.when(enabled && !show_editor_predictions, |this| {
|
||||
this.indicator(Indicator::dot().color(Color::Muted))
|
||||
.indicator_border_color(Some(cx.theme().colors().status_bar_background))
|
||||
})
|
||||
.when(!self.popover_menu_handle.is_deployed(), |element| {
|
||||
element.tooltip(move |window, cx| {
|
||||
if enabled {
|
||||
if show_editor_predictions {
|
||||
Tooltip::for_action("Edit Prediction", &ToggleMenu, window, cx)
|
||||
} else {
|
||||
Tooltip::with_meta(
|
||||
"Edit Prediction",
|
||||
Some(&ToggleMenu),
|
||||
"Hidden For This File",
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Tooltip::with_meta(
|
||||
"Edit Prediction",
|
||||
Some(&ToggleMenu),
|
||||
"Disabled For This File",
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
let this = cx.entity().clone();
|
||||
|
||||
Reference in New Issue
Block a user