welcome: Try Zed Edit Prediction (#24876)
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>
This commit is contained in:
parent
744579ede9
commit
4aae0e2f6c
3 changed files with 20 additions and 8 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -15489,12 +15489,12 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"client",
|
||||
"copilot",
|
||||
"db",
|
||||
"editor",
|
||||
"fuzzy",
|
||||
"gpui",
|
||||
"install_cli",
|
||||
"language",
|
||||
"picker",
|
||||
"project",
|
||||
"schemars",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue