Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Bennet Bo Fenner8c349057e59b
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json
index 243f5f9d4f3..ef9ab3f3693 100644
--- a/assets/keymaps/default-linux.json
+++ b/assets/keymaps/default-linux.json
@@ -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"
}
},
diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json
index 2773e48d38b..f2b37819d3e 100644
--- a/assets/keymaps/default-macos.json
+++ b/assets/keymaps/default-macos.json
@@ -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"
}
},
diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs
index c8b2bc333a6..8961512bd28 100644
--- a/crates/inline_completion_button/src/inline_completion_button.rs
+++ b/crates/inline_completion_button/src/inline_completion_button.rs
@@ -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()),
)
})
}
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index 9b66e92b9f5..271c8356448 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -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(),
diff --git a/crates/zeta/src/init.rs b/crates/zeta/src/init.rs
index ee0d810e5b1..229d4d287bd 100644
--- a/crates/zeta/src/init.rs
+++ b/crates/zeta/src/init.rs
@@ -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| {
diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs
index ed79f41fe8f..3c556253236 100644
--- a/crates/zeta/src/rate_completion_modal.rs
+++ b/crates/zeta/src/rate_completion_modal.rs
@@ -9,7 +9,6 @@ use workspace::{ModalView, Workspace};
actions!(
zeta,
[
- RateCompletions,
ThumbsUpActiveCompletion,
ThumbsDownActiveCompletion,
NextEdit,