welcome: Try Zed Edit Prediction (#24876)

Agus Zubiaga , Danilo Leal , Antonio Scandurra , and Marshall Bowers created

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>

Change summary

Cargo.lock                    |  2 +-
crates/welcome/Cargo.toml     |  4 ++--
crates/welcome/src/welcome.rs | 22 +++++++++++++++++-----
3 files changed, 20 insertions(+), 8 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -15489,12 +15489,12 @@ version = "0.1.0"
 dependencies = [
  "anyhow",
  "client",
- "copilot",
  "db",
  "editor",
  "fuzzy",
  "gpui",
  "install_cli",
+ "language",
  "picker",
  "project",
  "schemars",

crates/welcome/Cargo.toml 🔗

@@ -17,18 +17,18 @@ test-support = []
 [dependencies]
 anyhow.workspace = true
 client.workspace = true
-copilot.workspace = true
 db.workspace = true
 fuzzy.workspace = true
 gpui.workspace = true
 install_cli.workspace = true
+language.workspace = true
 picker.workspace = true
 project.workspace = true
 schemars.workspace = true
 serde.workspace = true
 settings.workspace = true
-ui.workspace = true
 telemetry.workspace = true
+ui.workspace = true
 util.workspace = true
 vim_mode_setting.workspace = true
 workspace.workspace = true

crates/welcome/src/welcome.rs 🔗

@@ -8,6 +8,7 @@ use gpui::{
     actions, svg, Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable,
     InteractiveElement, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window,
 };
+use language::language_settings::{all_language_settings, EditPredictionProvider};
 use settings::{Settings, SettingsStore};
 use std::sync::Arc;
 use ui::{prelude::*, CheckboxWithLabel, ElevationIndex, Tooltip};
@@ -73,6 +74,16 @@ pub struct WelcomePage {
 
 impl Render for WelcomePage {
     fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+        let edit_prediction_provider_is_zed =
+            all_language_settings(None, cx).edit_predictions.provider
+                == EditPredictionProvider::Zed;
+
+        let edit_prediction_label = if edit_prediction_provider_is_zed {
+            "Edit Prediction Enabled"
+        } else {
+            "Try Edit Prediction"
+        };
+
         h_flex()
             .size_full()
             .bg(cx.theme().colors().editor_background)
@@ -161,17 +172,18 @@ impl Render for WelcomePage {
                                     )
                                     .child(
                                         Button::new(
-                                            "sign-in-to-copilot",
-                                            "Sign in to GitHub Copilot",
+                                            "try-zed-edit-prediction",
+                                            edit_prediction_label,
                                         )
-                                        .icon(IconName::Copilot)
+                                        .disabled(edit_prediction_provider_is_zed)
+                                        .icon(IconName::ZedPredict)
                                         .icon_size(IconSize::XSmall)
                                         .icon_color(Color::Muted)
                                         .icon_position(IconPosition::Start)
                                         .on_click(
                                             cx.listener(|_, _, window, cx| {
-                                                telemetry::event!("Welcome Copilot Signed In");
-                                                copilot::initiate_sign_in(window, cx);
+                                                telemetry::event!("Welcome Screen Try Edit Prediction clicked");
+                                                window.dispatch_action(zed_actions::OpenZedPredictOnboarding.boxed_clone(), cx);
                                             }),
                                         ),
                                     )