From 4aae0e2f6cd6e304ca4e8f4ab24fe0dd7baa447d Mon Sep 17 00:00:00 2001 From: Agus Zubiaga Date: Fri, 14 Feb 2025 12:28:07 -0300 Subject: [PATCH] welcome: Try Zed Edit Prediction (#24876) Release Notes: - N/A --------- Co-authored-by: Danilo Leal Co-authored-by: Antonio Scandurra Co-authored-by: Marshall Bowers --- Cargo.lock | 2 +- crates/welcome/Cargo.toml | 4 ++-- crates/welcome/src/welcome.rs | 22 +++++++++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd45aca320..1c251aa0c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15489,12 +15489,12 @@ version = "0.1.0" dependencies = [ "anyhow", "client", - "copilot", "db", "editor", "fuzzy", "gpui", "install_cli", + "language", "picker", "project", "schemars", diff --git a/crates/welcome/Cargo.toml b/crates/welcome/Cargo.toml index a17e41e449..7579773310 100644 --- a/crates/welcome/Cargo.toml +++ b/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 diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs index 7b4ae729bd..5e8e4ff314 100644 --- a/crates/welcome/src/welcome.rs +++ b/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) -> 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); }), ), )