inline_completion_button: Put "Eager Preview Mode" menu entry behind a feature flag (#24734)
Marshall Bowers
created 11 months ago
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
Change summary
crates/feature_flags/src/feature_flags.rs | 11 +
crates/inline_completion_button/src/inline_completion_button.rs | 18 +-
2 files changed, 19 insertions(+), 10 deletions(-)
Detailed changes
@@ -69,6 +69,17 @@ impl FeatureFlag for PredictEditsRateCompletionsFeatureFlag {
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;
impl FeatureFlag for GitUiFeatureFlag {
const NAME: &'static str = "git-ui";
@@ -569,12 +569,12 @@ impl InlineCompletionButton {
);
}
- let is_eager_preview_enabled = match settings.edit_predictions_mode() {
- language::EditPredictionsMode::Auto => false,
- language::EditPredictionsMode::EagerPreview => true,
- };
- menu = if cx.is_staff() {
- menu.separator().toggleable_entry(
+ if cx.has_flag::<feature_flags::PredictEditsNonEagerModeFeatureFlag>() {
+ let is_eager_preview_enabled = match settings.edit_predictions_mode() {
+ language::EditPredictionsMode::Auto => false,
+ language::EditPredictionsMode::EagerPreview => true,
+ };
+ menu = menu.separator().toggleable_entry(
"Eager Preview Mode",
is_eager_preview_enabled,
IconPosition::Start,
@@ -604,10 +604,8 @@ impl InlineCompletionButton {
);
}
},
- )
- } else {
- menu
- };
+ );
+ }
if let Some(editor_focus_handle) = self.editor_focus_handle.clone() {
menu = menu