Remove sweep and mercury feature flags (#48329)

Max Brunsfeld created

Release Notes:

- N/A

Change summary

Cargo.lock                                                     |  1 
crates/edit_prediction/src/edit_prediction.rs                  | 12 --
crates/edit_prediction_ui/src/edit_prediction_button.rs        | 18 +--
crates/settings_ui/Cargo.toml                                  |  1 
crates/settings_ui/src/pages/edit_prediction_provider_setup.rs | 15 +-
crates/zed/src/zed/edit_prediction_registry.rs                 |  8 -
6 files changed, 17 insertions(+), 38 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -15131,7 +15131,6 @@ dependencies = [
  "edit_prediction",
  "edit_prediction_ui",
  "editor",
- "feature_flags",
  "fs",
  "futures 0.3.31",
  "fuzzy",

crates/edit_prediction/src/edit_prediction.rs 🔗

@@ -105,18 +105,6 @@ const LAST_CHANGE_GROUPING_TIME: Duration = Duration::from_secs(1);
 const ZED_PREDICT_DATA_COLLECTION_CHOICE: &str = "zed_predict_data_collection_choice";
 const REJECT_REQUEST_DEBOUNCE: Duration = Duration::from_secs(15);
 
-pub struct SweepFeatureFlag;
-
-impl FeatureFlag for SweepFeatureFlag {
-    const NAME: &str = "sweep-ai";
-}
-
-pub struct MercuryFeatureFlag;
-
-impl FeatureFlag for MercuryFeatureFlag {
-    const NAME: &str = "mercury";
-}
-
 static EDIT_PREDICTIONS_MODEL_ID: LazyLock<Option<String>> =
     LazyLock::new(|| env::var("ZED_ZETA_MODEL").ok());
 

crates/edit_prediction_ui/src/edit_prediction_button.rs 🔗

@@ -3,9 +3,7 @@ use client::{Client, UserStore, zed_urls};
 use cloud_llm_client::UsageLimit;
 use codestral::CodestralEditPredictionDelegate;
 use copilot::Status;
-use edit_prediction::{
-    EditPredictionStore, MercuryFeatureFlag, SweepFeatureFlag, Zeta2FeatureFlag,
-};
+use edit_prediction::{EditPredictionStore, Zeta2FeatureFlag};
 use edit_prediction_types::EditPredictionDelegateHandle;
 use editor::{
     Editor, MultiBufferOffset, SelectionEffects, actions::ShowEditPrediction, scroll::Autoscroll,
@@ -1358,18 +1356,16 @@ pub fn get_available_providers(cx: &mut App) -> Vec<EditPredictionProvider> {
         providers.push(EditPredictionProvider::Ollama);
     }
 
-    if cx.has_flag::<SweepFeatureFlag>()
-        && edit_prediction::sweep_ai::sweep_api_token(cx)
-            .read(cx)
-            .has_key()
+    if edit_prediction::sweep_ai::sweep_api_token(cx)
+        .read(cx)
+        .has_key()
     {
         providers.push(EditPredictionProvider::Sweep);
     }
 
-    if cx.has_flag::<MercuryFeatureFlag>()
-        && edit_prediction::mercury::mercury_api_token(cx)
-            .read(cx)
-            .has_key()
+    if edit_prediction::mercury::mercury_api_token(cx)
+        .read(cx)
+        .has_key()
     {
         providers.push(EditPredictionProvider::Mercury);
     }

crates/settings_ui/Cargo.toml 🔗

@@ -24,7 +24,6 @@ copilot_ui.workspace = true
 edit_prediction.workspace = true
 edit_prediction_ui.workspace = true
 editor.workspace = true
-feature_flags.workspace = true
 fs.workspace = true
 futures.workspace = true
 fuzzy.workspace = true

crates/settings_ui/src/pages/edit_prediction_provider_setup.rs 🔗

@@ -1,10 +1,9 @@
 use edit_prediction::{
-    ApiKeyState, MercuryFeatureFlag, SweepFeatureFlag,
+    ApiKeyState,
     mercury::{MERCURY_CREDENTIALS_URL, mercury_api_token},
     sweep_ai::{SWEEP_CREDENTIALS_URL, sweep_api_token},
 };
 use edit_prediction_ui::{get_available_providers, set_completion_provider};
-use feature_flags::FeatureFlagAppExt as _;
 use gpui::{Entity, ScrollHandle, prelude::*};
 use language::language_settings::AllLanguageSettings;
 use language_models::provider::mistral::{CODESTRAL_API_URL, codestral_api_key};
@@ -29,7 +28,7 @@ pub(crate) fn render_edit_prediction_setup_page(
     let providers = [
         Some(render_provider_dropdown(window, cx)),
         render_github_copilot_provider(window, cx).map(IntoElement::into_any_element),
-        cx.has_flag::<MercuryFeatureFlag>().then(|| {
+        Some(
             render_api_key_provider(
                 IconName::Inception,
                 "Mercury",
@@ -40,9 +39,9 @@ pub(crate) fn render_edit_prediction_setup_page(
                 window,
                 cx,
             )
-            .into_any_element()
-        }),
-        cx.has_flag::<SweepFeatureFlag>().then(|| {
+            .into_any_element(),
+        ),
+        Some(
             render_api_key_provider(
                 IconName::SweepAi,
                 "Sweep",
@@ -62,8 +61,8 @@ pub(crate) fn render_edit_prediction_setup_page(
                 window,
                 cx,
             )
-            .into_any_element()
-        }),
+            .into_any_element(),
+        ),
         Some(render_ollama_provider(settings_window, window, cx).into_any_element()),
         Some(
             render_api_key_provider(

crates/zed/src/zed/edit_prediction_registry.rs 🔗

@@ -2,9 +2,7 @@ use client::{Client, UserStore};
 use codestral::CodestralEditPredictionDelegate;
 use collections::HashMap;
 use copilot::CopilotEditPredictionDelegate;
-use edit_prediction::{
-    MercuryFeatureFlag, SweepFeatureFlag, ZedEditPredictionDelegate, Zeta2FeatureFlag,
-};
+use edit_prediction::{ZedEditPredictionDelegate, Zeta2FeatureFlag};
 use editor::Editor;
 use feature_flags::FeatureFlagAppExt;
 use gpui::{AnyWindowHandle, App, AppContext as _, Context, Entity, WeakEntity};
@@ -204,10 +202,10 @@ fn assign_edit_prediction_provider(
             {
                 let has_model = ep_store.update(cx, |ep_store, cx| {
                     let model = match value {
-                        EditPredictionProvider::Sweep if cx.has_flag::<SweepFeatureFlag>() => {
+                        EditPredictionProvider::Sweep => {
                             edit_prediction::EditPredictionModel::Sweep
                         }
-                        EditPredictionProvider::Mercury if cx.has_flag::<MercuryFeatureFlag>() => {
+                        EditPredictionProvider::Mercury => {
                             edit_prediction::EditPredictionModel::Mercury
                         }
                         EditPredictionProvider::Ollama => {