diff --git a/Cargo.lock b/Cargo.lock index 0316c343cb4ea5922897d9fc8ab417793e770ade..e0bfcc79b63f38e03a6984d21d7e8fdba85cb329 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 588c747696c3ed58696bd12fbe97f3cbf3f9ef8a..fefd49090fd2020f4dc6da8aa1c2a1c5d119ea96 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 658eb3451f473d4a9af26053dae20f21479c339e..89d1086c8e4b897c3527964289ff11810078a57c 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 63788f9d28a5097bab1f02ab340c253b704cc599..e166e760c13dc8faddfd45f9712ebfb84c826393 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 60b25fee12ab8c32ca6894fb2363f271f27246a4..3b561da2f142a771157f4ed3c141c41768428cb4 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 4c736e930e0cf5f0a325a267af68295b37e68079..a632ce08d050dbc1f10d9a163da23afa0fedc9ff 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 e0da81edc4ae17702b55a306bae3ec8b9d7a2bfd..e41baee4aea80c39bf5153f15f6fb1f80db4bb53 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()))