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 = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"client",
|
"client",
|
||||||
"copilot",
|
|
||||||
"db",
|
"db",
|
||||||
"editor",
|
"editor",
|
||||||
"fuzzy",
|
"fuzzy",
|
||||||
"gpui",
|
"gpui",
|
||||||
"install_cli",
|
"install_cli",
|
||||||
|
"language",
|
||||||
"picker",
|
"picker",
|
||||||
"project",
|
"project",
|
||||||
"schemars",
|
"schemars",
|
||||||
|
|
|
@ -17,18 +17,18 @@ test-support = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
client.workspace = true
|
client.workspace = true
|
||||||
copilot.workspace = true
|
|
||||||
db.workspace = true
|
db.workspace = true
|
||||||
fuzzy.workspace = true
|
fuzzy.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
install_cli.workspace = true
|
install_cli.workspace = true
|
||||||
|
language.workspace = true
|
||||||
picker.workspace = true
|
picker.workspace = true
|
||||||
project.workspace = true
|
project.workspace = true
|
||||||
schemars.workspace = true
|
schemars.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
settings.workspace = true
|
settings.workspace = true
|
||||||
ui.workspace = true
|
|
||||||
telemetry.workspace = true
|
telemetry.workspace = true
|
||||||
|
ui.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
vim_mode_setting.workspace = true
|
vim_mode_setting.workspace = true
|
||||||
workspace.workspace = true
|
workspace.workspace = true
|
||||||
|
|
|
@ -8,6 +8,7 @@ use gpui::{
|
||||||
actions, svg, Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable,
|
actions, svg, Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable,
|
||||||
InteractiveElement, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window,
|
InteractiveElement, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window,
|
||||||
};
|
};
|
||||||
|
use language::language_settings::{all_language_settings, EditPredictionProvider};
|
||||||
use settings::{Settings, SettingsStore};
|
use settings::{Settings, SettingsStore};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use ui::{prelude::*, CheckboxWithLabel, ElevationIndex, Tooltip};
|
use ui::{prelude::*, CheckboxWithLabel, ElevationIndex, Tooltip};
|
||||||
|
@ -73,6 +74,16 @@ pub struct WelcomePage {
|
||||||
|
|
||||||
impl Render for WelcomePage {
|
impl Render for WelcomePage {
|
||||||
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
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()
|
h_flex()
|
||||||
.size_full()
|
.size_full()
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
|
@ -161,17 +172,18 @@ impl Render for WelcomePage {
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::new(
|
Button::new(
|
||||||
"sign-in-to-copilot",
|
"try-zed-edit-prediction",
|
||||||
"Sign in to GitHub Copilot",
|
edit_prediction_label,
|
||||||
)
|
)
|
||||||
.icon(IconName::Copilot)
|
.disabled(edit_prediction_provider_is_zed)
|
||||||
|
.icon(IconName::ZedPredict)
|
||||||
.icon_size(IconSize::XSmall)
|
.icon_size(IconSize::XSmall)
|
||||||
.icon_color(Color::Muted)
|
.icon_color(Color::Muted)
|
||||||
.icon_position(IconPosition::Start)
|
.icon_position(IconPosition::Start)
|
||||||
.on_click(
|
.on_click(
|
||||||
cx.listener(|_, _, window, cx| {
|
cx.listener(|_, _, window, cx| {
|
||||||
telemetry::event!("Welcome Copilot Signed In");
|
telemetry::event!("Welcome Screen Try Edit Prediction clicked");
|
||||||
copilot::initiate_sign_in(window, cx);
|
window.dispatch_action(zed_actions::OpenZedPredictOnboarding.boxed_clone(), cx);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue