inline_completion_button: Put "Eager Preview Mode" menu entry behind a feature flag (#24734)

This PR puts the "Eager Preview Mode" menu entry behind a feature flag
rather than a staff flag.

Currently it defaults to `false` for staff so that it doesn't leak into
any marketing/launch materials.

Folks who want to see it can opt-in to the flag explicitly, for now.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-02-12 11:23:23 -05:00 committed by GitHub
parent 51092c4e31
commit 3f95d79fc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 10 deletions

View file

@ -69,6 +69,17 @@ impl FeatureFlag for PredictEditsRateCompletionsFeatureFlag {
const NAME: &'static str = "predict-edits-rate-completions"; const NAME: &'static str = "predict-edits-rate-completions";
} }
/// A feature flag that controls whether "non eager mode" (holding `alt` to preview) is publicized.
pub struct PredictEditsNonEagerModeFeatureFlag;
impl FeatureFlag for PredictEditsNonEagerModeFeatureFlag {
const NAME: &'static str = "predict-edits-non-eager-mode";
fn enabled_for_staff() -> bool {
// Don't show to staff so it doesn't leak into media for the launch.
false
}
}
pub struct GitUiFeatureFlag; pub struct GitUiFeatureFlag;
impl FeatureFlag for GitUiFeatureFlag { impl FeatureFlag for GitUiFeatureFlag {
const NAME: &'static str = "git-ui"; const NAME: &'static str = "git-ui";

View file

@ -569,12 +569,12 @@ impl InlineCompletionButton {
); );
} }
let is_eager_preview_enabled = match settings.edit_predictions_mode() { if cx.has_flag::<feature_flags::PredictEditsNonEagerModeFeatureFlag>() {
language::EditPredictionsMode::Auto => false, let is_eager_preview_enabled = match settings.edit_predictions_mode() {
language::EditPredictionsMode::EagerPreview => true, language::EditPredictionsMode::Auto => false,
}; language::EditPredictionsMode::EagerPreview => true,
menu = if cx.is_staff() { };
menu.separator().toggleable_entry( menu = menu.separator().toggleable_entry(
"Eager Preview Mode", "Eager Preview Mode",
is_eager_preview_enabled, is_eager_preview_enabled,
IconPosition::Start, IconPosition::Start,
@ -604,10 +604,8 @@ impl InlineCompletionButton {
); );
} }
}, },
) );
} else { }
menu
};
if let Some(editor_focus_handle) = self.editor_focus_handle.clone() { if let Some(editor_focus_handle) = self.editor_focus_handle.clone() {
menu = menu menu = menu