edit prediction: Fix zeta: Rate completions action not working when using keybinding (#24569)
Release Notes: - N/A
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
"ctrl-,": "zed::OpenSettings",
|
"ctrl-,": "zed::OpenSettings",
|
||||||
"ctrl-q": "zed::Quit",
|
"ctrl-q": "zed::Quit",
|
||||||
"f11": "zed::ToggleFullScreen",
|
"f11": "zed::ToggleFullScreen",
|
||||||
"ctrl-alt-z": "zeta::RateCompletions",
|
"ctrl-alt-z": "edit_prediction::RateCompletions",
|
||||||
"ctrl-shift-i": "edit_prediction::ToggleMenu"
|
"ctrl-shift-i": "edit_prediction::ToggleMenu"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"cmd-m": "zed::Minimize",
|
"cmd-m": "zed::Minimize",
|
||||||
"fn-f": "zed::ToggleFullScreen",
|
"fn-f": "zed::ToggleFullScreen",
|
||||||
"ctrl-cmd-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"
|
"ctrl-cmd-i": "edit_prediction::ToggleMenu"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,9 +36,8 @@ use workspace::{
|
|||||||
Toast, Workspace,
|
Toast, Workspace,
|
||||||
};
|
};
|
||||||
use zed_actions::OpenBrowser;
|
use zed_actions::OpenBrowser;
|
||||||
use zeta::RateCompletionModal;
|
use zeta::RateCompletions;
|
||||||
|
|
||||||
actions!(zeta, [RateCompletions]);
|
|
||||||
actions!(edit_prediction, [ToggleMenu]);
|
actions!(edit_prediction, [ToggleMenu]);
|
||||||
|
|
||||||
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
|
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
|
||||||
@@ -54,7 +53,6 @@ pub struct InlineCompletionButton {
|
|||||||
file: Option<Arc<dyn File>>,
|
file: Option<Arc<dyn File>>,
|
||||||
edit_prediction_provider: Option<Arc<dyn inline_completion::InlineCompletionProviderHandle>>,
|
edit_prediction_provider: Option<Arc<dyn inline_completion::InlineCompletionProviderHandle>>,
|
||||||
fs: Arc<dyn Fs>,
|
fs: Arc<dyn Fs>,
|
||||||
workspace: WeakEntity<Workspace>,
|
|
||||||
user_store: Entity<UserStore>,
|
user_store: Entity<UserStore>,
|
||||||
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
|
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
|
||||||
}
|
}
|
||||||
@@ -354,7 +352,6 @@ impl Render for InlineCompletionButton {
|
|||||||
|
|
||||||
impl InlineCompletionButton {
|
impl InlineCompletionButton {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
workspace: WeakEntity<Workspace>,
|
|
||||||
fs: Arc<dyn Fs>,
|
fs: Arc<dyn Fs>,
|
||||||
user_store: Entity<UserStore>,
|
user_store: Entity<UserStore>,
|
||||||
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
|
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
|
||||||
@@ -376,7 +373,6 @@ impl InlineCompletionButton {
|
|||||||
file: None,
|
file: None,
|
||||||
edit_prediction_provider: None,
|
edit_prediction_provider: None,
|
||||||
popover_menu_handle,
|
popover_menu_handle,
|
||||||
workspace,
|
|
||||||
fs,
|
fs,
|
||||||
user_store,
|
user_store,
|
||||||
}
|
}
|
||||||
@@ -613,23 +609,10 @@ impl InlineCompletionButton {
|
|||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Entity<ContextMenu> {
|
) -> Entity<ContextMenu> {
|
||||||
let workspace = self.workspace.clone();
|
|
||||||
ContextMenu::build(window, cx, |menu, _window, cx| {
|
ContextMenu::build(window, cx, |menu, _window, cx| {
|
||||||
self.build_language_settings_menu(menu, cx).when(
|
self.build_language_settings_menu(menu, cx).when(
|
||||||
cx.has_flag::<PredictEditsRateCompletionsFeatureFlag>(),
|
cx.has_flag::<PredictEditsRateCompletionsFeatureFlag>(),
|
||||||
|this| {
|
|this| this.action("Rate Completions", RateCompletions.boxed_clone()),
|
||||||
this.entry(
|
|
||||||
"Rate Completions",
|
|
||||||
Some(RateCompletions.boxed_clone()),
|
|
||||||
move |window, cx| {
|
|
||||||
workspace
|
|
||||||
.update(cx, |workspace, cx| {
|
|
||||||
RateCompletionModal::toggle(workspace, window, cx)
|
|
||||||
})
|
|
||||||
.ok();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ pub fn initialize_workspace(
|
|||||||
|
|
||||||
let inline_completion_button = cx.new(|cx| {
|
let inline_completion_button = cx.new(|cx| {
|
||||||
inline_completion_button::InlineCompletionButton::new(
|
inline_completion_button::InlineCompletionButton::new(
|
||||||
workspace.weak_handle(),
|
|
||||||
app_state.fs.clone(),
|
app_state.fs.clone(),
|
||||||
app_state.user_store.clone(),
|
app_state.user_store.clone(),
|
||||||
popover_menu_handle.clone(),
|
popover_menu_handle.clone(),
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ use settings::update_settings_file;
|
|||||||
use ui::App;
|
use ui::App;
|
||||||
use workspace::Workspace;
|
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) {
|
pub fn init(cx: &mut App) {
|
||||||
cx.observe_new(move |workspace: &mut Workspace, _, _cx| {
|
cx.observe_new(move |workspace: &mut Workspace, _, _cx| {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use workspace::{ModalView, Workspace};
|
|||||||
actions!(
|
actions!(
|
||||||
zeta,
|
zeta,
|
||||||
[
|
[
|
||||||
RateCompletions,
|
|
||||||
ThumbsUpActiveCompletion,
|
ThumbsUpActiveCompletion,
|
||||||
ThumbsDownActiveCompletion,
|
ThumbsDownActiveCompletion,
|
||||||
NextEdit,
|
NextEdit,
|
||||||
|
|||||||
Reference in New Issue
Block a user