diff --git a/Cargo.lock b/Cargo.lock index 0316c343cb..e0bfcc79b6 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.toml index 588c747696..fefd49090f 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 = true async-tar = "0.4.2" anyhow.workspace = true diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index 658eb3451f..89d1086c8e 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) { copilot diff --git a/crates/copilot_button/Cargo.toml b/crates/copilot_button/Cargo.toml index 63788f9d28..e166e760c1 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 = true diff --git a/crates/copilot_button/src/copilot_button.rs b/crates/copilot_button/src/copilot_button.rs index 60b25fee12..3b561da2f1 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, diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot_button/src/sign_in.rs similarity index 98% rename from crates/copilot/src/sign_in.rs rename to crates/copilot_button/src/sign_in.rs index 4c736e930e..a632ce08d0 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.rs index e0da81edc4..e41baee4ae 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()))