Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Move UI for copilot sign in to copilot_button
Piotr Osiewicz3e8e1c640451
diff --git a/Cargo.lock b/Cargo.lockindex 0316c343cb4..e0bfcc79b63 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1684,7 +1684,6 @@ dependencies = ["settings","smol","theme",- "ui","util",]@@ -1702,6 +1701,7 @@ dependencies = ["settings","smol","theme",+ "ui","util","workspace","zed_actions",diff --git a/crates/copilot/Cargo.toml b/crates/copilot/Cargo.tomlindex 588c747696c..fefd49090fd 100644--- a/crates/copilot/Cargo.toml+++ b/crates/copilot/Cargo.toml@@ -28,7 +28,6 @@ theme = { path = "../theme" }lsp = { path = "../lsp" }node_runtime = { path = "../node_runtime"}util = { path = "../util" }-ui = { path = "../ui" }async-compression.workspace = trueasync-tar = "0.4.2"anyhow.workspace = truediff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rsindex 658eb3451f4..89d1086c8e4 100644--- a/crates/copilot/src/copilot.rs+++ b/crates/copilot/src/copilot.rs@@ -1,6 +1,4 @@pub mod request;-mod sign_in;-use anyhow::{anyhow, Context as _, Result};use async_compression::futures::bufread::GzipDecoder;use async_tar::Archive;@@ -98,7 +96,6 @@ pub fn init(}).detach();- sign_in::init(cx);cx.on_action(|_: &SignIn, cx| {if let Some(copilot) = Copilot::global(cx) {copilotdiff --git a/crates/copilot_button/Cargo.toml b/crates/copilot_button/Cargo.tomlindex 63788f9d28a..e166e760c13 100644--- a/crates/copilot_button/Cargo.toml+++ b/crates/copilot_button/Cargo.toml@@ -17,6 +17,7 @@ gpui = { path = "../gpui" }language = { path = "../language" }settings = { path = "../settings" }theme = { path = "../theme" }+ui = { path = "../ui" }util = { path = "../util" }workspace = {path = "../workspace" }anyhow.workspace = truediff --git a/crates/copilot_button/src/copilot_button.rs b/crates/copilot_button/src/copilot_button.rsindex 60b25fee12a..3b561da2f14 100644--- a/crates/copilot_button/src/copilot_button.rs+++ b/crates/copilot_button/src/copilot_button.rs@@ -1,3 +1,5 @@+mod sign_in;+use anyhow::Result;use copilot::{Copilot, SignOut, Status};use editor::{scroll::autoscroll::Autoscroll, Editor};@@ -25,6 +27,10 @@ const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";const COPILOT_STARTING_TOAST_ID: usize = 1337;const COPILOT_ERROR_TOAST_ID: usize = 1338;+pub fn init(cx: &mut AppContext) {+ sign_in::init(cx);+}+pub struct CopilotButton {editor_subscription: Option<(Subscription, usize)>,editor_enabled: Option<bool>,diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot_button/src/sign_in.rssimilarity index 98%rename from crates/copilot/src/sign_in.rsrename to crates/copilot_button/src/sign_in.rsindex 4c736e930e0..a632ce08d05 100644--- a/crates/copilot/src/sign_in.rs+++ b/crates/copilot_button/src/sign_in.rs@@ -1,4 +1,4 @@-use crate::{request::PromptUserDeviceFlow, Copilot, Status};+use copilot::{request::PromptUserDeviceFlow, Copilot, Status};use gpui::{div, size, svg, AppContext, Bounds, ClipboardItem, Element, GlobalPixels, InteractiveElement,IntoElement, ParentElement, Point, Render, Styled, ViewContext, VisualContext, WindowBounds,@@ -80,6 +80,7 @@ pub struct CopilotCodeVerification {connect_clicked: bool,}+//impl ModalView for CopilotCodeVerification {}impl CopilotCodeVerification {pub fn new(status: Status) -> Self {Self {diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex e0da81edc4a..e41baee4aea 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -158,6 +158,7 @@ fn main() {node_runtime.clone(),cx,);+ copilot_button::init(cx);assistant::init(cx);cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))