From 0fe335efc522d6a2578c8bf58493624136c39a71 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 10 Dec 2025 13:02:38 -0500 Subject: [PATCH] Revise Copilot auth --- crates/extension/src/extension_manifest.rs | 3 +++ crates/extension_host/src/extension_host.rs | 8 +----- .../src/wasm_host/llm_provider.rs | 25 +++++++++++++++---- extensions/copilot-chat/extension.toml | 7 +++--- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/crates/extension/src/extension_manifest.rs b/crates/extension/src/extension_manifest.rs index 3a09a602d5b46180548fb9bcfff8f3b3e7cdae53..e010b5e258446be704b556d4169bfbe5d2d83870 100644 --- a/crates/extension/src/extension_manifest.rs +++ b/crates/extension/src/extension_manifest.rs @@ -350,6 +350,9 @@ pub struct OAuthConfig { /// The text to display on the sign-in button (e.g., "Sign in with GitHub"). #[serde(default)] pub sign_in_button_label: Option, + /// The icon to display on the sign-in button (e.g., "github"). + #[serde(default)] + pub sign_in_button_icon: Option, } impl ExtensionManifest { diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index 17f9fe21e1e81db7c17ae2c55371d64d127bc3bf..a08b006fbbb8478546ca01fe3082478fba0c1fd8 100644 --- a/crates/extension_host/src/extension_host.rs +++ b/crates/extension_host/src/extension_host.rs @@ -58,7 +58,7 @@ use std::{ cmp::Ordering, path::{self, Path, PathBuf}, sync::Arc, - time::{Duration, Instant}, + time::Duration, }; use url::Url; use util::{ResultExt, paths::RemotePathBuf}; @@ -1298,11 +1298,6 @@ impl ExtensionStore { return Task::ready(()); } - let reload_count = extensions_to_unload - .iter() - .filter(|id| extensions_to_load.contains(id)) - .count(); - let extension_ids = extensions_to_load .iter() .filter_map(|id| { @@ -1786,7 +1781,6 @@ impl ExtensionStore { let index_path = self.index_path.clone(); let proxy = self.proxy.clone(); cx.background_spawn(async move { - let start_time = Instant::now(); let mut index = ExtensionIndex::default(); fs.create_dir(&work_dir).await.log_err(); diff --git a/crates/extension_host/src/wasm_host/llm_provider.rs b/crates/extension_host/src/wasm_host/llm_provider.rs index c1d37babf824eaef9654267156f306d1322be755..6eb506127e1e34b4250bed5f45668fb0942fdfd0 100644 --- a/crates/extension_host/src/wasm_host/llm_provider.rs +++ b/crates/extension_host/src/wasm_host/llm_provider.rs @@ -891,6 +891,12 @@ impl gpui::Render for ExtensionProviderConfigurationView { let button_label = oauth_config .and_then(|c| c.sign_in_button_label.clone()) .unwrap_or_else(|| "Sign In".to_string()); + let button_icon = oauth_config + .and_then(|c| c.sign_in_button_icon.as_ref()) + .and_then(|icon_name| match icon_name.as_str() { + "github" => Some(ui::IconName::Github), + _ => None, + }); let oauth_in_progress = self.oauth_in_progress; @@ -899,14 +905,23 @@ impl gpui::Render for ExtensionProviderConfigurationView { content = content.child( v_flex() .gap_2() - .child( - ui::Button::new("oauth-sign-in", button_label) - .style(ui::ButtonStyle::Filled) + .child({ + let mut button = ui::Button::new("oauth-sign-in", button_label) + .full_width() + .style(ui::ButtonStyle::Outlined) .disabled(oauth_in_progress) .on_click(cx.listener(|this, _, _window, cx| { this.start_oauth_sign_in(cx); - })), - ) + })); + if let Some(icon) = button_icon { + button = button + .icon(icon) + .icon_position(ui::IconPosition::Start) + .icon_size(ui::IconSize::Small) + .icon_color(Color::Muted); + } + button + }) .when(oauth_in_progress, |this| { let user_code = self.device_user_code.clone(); this.child( diff --git a/extensions/copilot-chat/extension.toml b/extensions/copilot-chat/extension.toml index 5e77c6dda4144f39f4ad904ed1fe6f7276f4845d..66d27aeb9240be87e28b61dfda15bd7706e8464f 100644 --- a/extensions/copilot-chat/extension.toml +++ b/extensions/copilot-chat/extension.toml @@ -8,9 +8,8 @@ repository = "https://github.com/zed-industries/zed" [language_model_providers.copilot-chat] name = "Copilot Chat" - -[language_model_providers.copilot-chat.auth] -env_var = "GH_COPILOT_TOKEN" +icon = "icons/copilot.svg" [language_model_providers.copilot-chat.auth.oauth] -sign_in_button_label = "Sign in with GitHub" \ No newline at end of file +sign_in_button_label = "Sign in to use GitHub Copilot" +sign_in_button_icon = "github" \ No newline at end of file