edit prediction: Fix zeta: Rate completions action not working when using keybinding (#24569)

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2025-02-11 12:14:42 +01:00 committed by GitHub
parent a1d4bd94c9
commit 8c349057e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 6 additions and 25 deletions

View file

@ -31,7 +31,7 @@
"ctrl-,": "zed::OpenSettings",
"ctrl-q": "zed::Quit",
"f11": "zed::ToggleFullScreen",
"ctrl-alt-z": "zeta::RateCompletions",
"ctrl-alt-z": "edit_prediction::RateCompletions",
"ctrl-shift-i": "edit_prediction::ToggleMenu"
}
},

View file

@ -39,7 +39,7 @@
"cmd-m": "zed::Minimize",
"fn-f": "zed::ToggleFullScreen",
"ctrl-cmd-f": "zed::ToggleFullScreen",
"ctrl-cmd-z": "zeta::RateCompletions",
"ctrl-cmd-z": "edit_prediction::RateCompletions",
"ctrl-cmd-i": "edit_prediction::ToggleMenu"
}
},

View file

@ -36,9 +36,8 @@ use workspace::{
Toast, Workspace,
};
use zed_actions::OpenBrowser;
use zeta::RateCompletionModal;
use zeta::RateCompletions;
actions!(zeta, [RateCompletions]);
actions!(edit_prediction, [ToggleMenu]);
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
@ -54,7 +53,6 @@ pub struct InlineCompletionButton {
file: Option<Arc<dyn File>>,
edit_prediction_provider: Option<Arc<dyn inline_completion::InlineCompletionProviderHandle>>,
fs: Arc<dyn Fs>,
workspace: WeakEntity<Workspace>,
user_store: Entity<UserStore>,
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
}
@ -354,7 +352,6 @@ impl Render for InlineCompletionButton {
impl InlineCompletionButton {
pub fn new(
workspace: WeakEntity<Workspace>,
fs: Arc<dyn Fs>,
user_store: Entity<UserStore>,
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
@ -376,7 +373,6 @@ impl InlineCompletionButton {
file: None,
edit_prediction_provider: None,
popover_menu_handle,
workspace,
fs,
user_store,
}
@ -613,23 +609,10 @@ impl InlineCompletionButton {
window: &mut Window,
cx: &mut Context<Self>,
) -> Entity<ContextMenu> {
let workspace = self.workspace.clone();
ContextMenu::build(window, cx, |menu, _window, cx| {
self.build_language_settings_menu(menu, cx).when(
cx.has_flag::<PredictEditsRateCompletionsFeatureFlag>(),
|this| {
this.entry(
"Rate Completions",
Some(RateCompletions.boxed_clone()),
move |window, cx| {
workspace
.update(cx, |workspace, cx| {
RateCompletionModal::toggle(workspace, window, cx)
})
.ok();
},
)
},
|this| this.action("Rate Completions", RateCompletions.boxed_clone()),
)
})
}

View file

@ -176,7 +176,6 @@ pub fn initialize_workspace(
let inline_completion_button = cx.new(|cx| {
inline_completion_button::InlineCompletionButton::new(
workspace.weak_handle(),
app_state.fs.clone(),
app_state.user_store.clone(),
popover_menu_handle.clone(),

View file

@ -10,9 +10,9 @@ use settings::update_settings_file;
use ui::App;
use workspace::Workspace;
use crate::{onboarding_modal::ZedPredictModal, RateCompletionModal, RateCompletions};
use crate::{onboarding_modal::ZedPredictModal, RateCompletionModal};
actions!(edit_predictions, [ResetOnboarding]);
actions!(edit_prediction, [ResetOnboarding, RateCompletions]);
pub fn init(cx: &mut App) {
cx.observe_new(move |workspace: &mut Workspace, _, _cx| {

View file

@ -9,7 +9,6 @@ use workspace::{ModalView, Workspace};
actions!(
zeta,
[
RateCompletions,
ThumbsUpActiveCompletion,
ThumbsDownActiveCompletion,
NextEdit,