Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add option to sign in to copilot from welcome screen (#8853)

Joseph T. Lyons95e532c56dc9
diff --git a/Cargo.lock b/Cargo.lock
index 5e7864f9b90..37684379a94 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11937,6 +11937,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"client",
+ "copilot_ui",
"db",
"editor",
"fuzzy",
diff --git a/crates/copilot_ui/src/copilot_button.rs b/crates/copilot_ui/src/copilot_button.rs
index dca74113885..afc39c3d192 100644
--- a/crates/copilot_ui/src/copilot_button.rs
+++ b/crates/copilot_ui/src/copilot_button.rs
@@ -332,7 +332,7 @@ fn hide_copilot(fs: Arc<dyn Fs>, cx: &mut AppContext) {
});
}
-fn initiate_sign_in(cx: &mut WindowContext) {
+pub fn initiate_sign_in(cx: &mut WindowContext) {
let Some(copilot) = Copilot::global(cx) else {
return;
};
diff --git a/crates/copilot_ui/src/copilot_ui.rs b/crates/copilot_ui/src/copilot_ui.rs
index 64dd068d5af..f55090ebcb2 100644
--- a/crates/copilot_ui/src/copilot_ui.rs
+++ b/crates/copilot_ui/src/copilot_ui.rs
@@ -1,4 +1,4 @@
-mod copilot_button;
+pub mod copilot_button;
mod sign_in;
pub use copilot_button::*;
diff --git a/crates/welcome/Cargo.toml b/crates/welcome/Cargo.toml
index e958bf26ffa..2200db8bbde 100644
--- a/crates/welcome/Cargo.toml
+++ b/crates/welcome/Cargo.toml
@@ -14,6 +14,7 @@ test-support = []
[dependencies]
anyhow.workspace = true
client.workspace = true
+copilot_ui.workspace = true
db.workspace = true
fuzzy.workspace = true
gpui.workspace = true
diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs
index 9a97fde6c35..01ffe2a1667 100644
--- a/crates/welcome/src/welcome.rs
+++ b/crates/welcome/src/welcome.rs
@@ -2,6 +2,7 @@ mod base_keymap_picker;
mod base_keymap_setting;
use client::{telemetry::Telemetry, TelemetrySettings};
+use copilot_ui;
use db::kvp::KEY_VALUE_STORE;
use gpui::{
svg, AnyElement, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
@@ -134,6 +135,16 @@ impl Render for WelcomePage {
})
.detach_and_log_err(cx);
})),
+ )
+ .child(
+ Button::new("sign-in-to-copilot", "Sign in to GitHub Copilot")
+ .full_width()
+ .on_click(cx.listener(|this, _, cx| {
+ this.telemetry.report_app_event(
+ "welcome page: sign in to copilot".to_string(),
+ );
+ copilot_ui::initiate_sign_in(cx);
+ })),
),
)
.child(