Move UI for copilot sign in to copilot_button

This commit is contained in:
Piotr Osiewicz 2024-01-05 15:58:45 +01:00
parent f7a036e952
commit 3e8e1c6404
7 changed files with 11 additions and 6 deletions

2
Cargo.lock generated
View File

@ -1684,7 +1684,6 @@ dependencies = [
"settings",
"smol",
"theme",
"ui",
"util",
]
@ -1702,6 +1701,7 @@ dependencies = [
"settings",
"smol",
"theme",
"ui",
"util",
"workspace",
"zed_actions",

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>,

View File

@ -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 {

View File

@ -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()))