From 36c7b3eb9130fc7954458a74fa075d18e4647794 Mon Sep 17 00:00:00 2001 From: Agus Zubiaga Date: Mon, 20 Jan 2025 17:13:47 -0300 Subject: [PATCH] Hide "Edit prediction" tooltip when menu is open (#23377) Release Notes: - N/A --- .../src/inline_completion_button.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs index 39bff55709..1b11f988c2 100644 --- a/crates/inline_completion_button/src/inline_completion_button.rs +++ b/crates/inline_completion_button/src/inline_completion_button.rs @@ -18,7 +18,10 @@ use language::{ use settings::{update_settings_file, Settings, SettingsStore}; use std::{path::Path, sync::Arc, time::Duration}; use supermaven::{AccountStatus, Supermaven}; -use ui::{ActiveTheme as _, ButtonLike, Color, Icon, IconWithIndicator, Indicator}; +use ui::{ + ActiveTheme as _, ButtonLike, Color, FluentBuilder as _, Icon, IconWithIndicator, Indicator, + PopoverMenuHandle, +}; use workspace::{ create_and_open_local_file, item::ItemHandle, @@ -47,6 +50,7 @@ pub struct InlineCompletionButton { fs: Arc, workspace: WeakView, user_store: Model, + zeta_popover_menu_handle: PopoverMenuHandle, } enum SupermavenButtonStatus { @@ -251,7 +255,9 @@ impl Render for InlineCompletionButton { let this = cx.view().clone(); let button = IconButton::new("zeta", IconName::ZedPredict) - .tooltip(|cx| Tooltip::text("Edit Prediction", cx)); + .when(!self.zeta_popover_menu_handle.is_deployed(), |button| { + button.tooltip(|cx| Tooltip::text("Edit Prediction", cx)) + }); let is_refreshing = self .inline_completion_provider @@ -262,7 +268,9 @@ impl Render for InlineCompletionButton { .menu(move |cx| { Some(this.update(cx, |this, cx| this.build_zeta_context_menu(cx))) }) - .anchor(Corner::BottomRight); + .anchor(Corner::BottomRight) + .with_handle(self.zeta_popover_menu_handle.clone()); + if is_refreshing { popover_menu = popover_menu.trigger( button.with_animation( @@ -303,6 +311,7 @@ impl InlineCompletionButton { language: None, file: None, inline_completion_provider: None, + zeta_popover_menu_handle: PopoverMenuHandle::default(), workspace, fs, user_store,