Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

copilot_chat: Remove dependency on `zed_credentials_provider` (#62208)

Bennet Bo Fenner6153542cf6e3
diff --git a/Cargo.lock b/Cargo.lock
index 6efeb1bc431..ccabb0bd88c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3897,7 +3897,6 @@ dependencies = [
"serde",
"serde_json",
"util",
- "zed_credentials_provider",
]
[[package]]
@@ -23432,6 +23431,7 @@ dependencies = [
"workspace",
"zed-reqwest",
"zed_actions",
+ "zed_credentials_provider",
"zed_env_vars",
"zlog",
"zlog_settings",
diff --git a/crates/copilot_chat/Cargo.toml b/crates/copilot_chat/Cargo.toml
index 8dbec0e0c40..87ded3a486e 100644
--- a/crates/copilot_chat/Cargo.toml
+++ b/crates/copilot_chat/Cargo.toml
@@ -29,7 +29,6 @@ log.workspace = true
serde.workspace = true
serde_json.workspace = true
util.workspace = true
-zed_credentials_provider.workspace = true
[dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
diff --git a/crates/copilot_chat/src/copilot_chat.rs b/crates/copilot_chat/src/copilot_chat.rs
index 3c1a16cddae..a690333e0c1 100644
--- a/crates/copilot_chat/src/copilot_chat.rs
+++ b/crates/copilot_chat/src/copilot_chat.rs
@@ -534,8 +534,12 @@ pub struct CopilotChat {
sign_in_task: Option<Task<()>>,
}
-pub fn init(client: Arc<dyn HttpClient>, configuration: CopilotChatConfiguration, cx: &mut App) {
- let credentials_provider = zed_credentials_provider::global(cx);
+pub fn init(
+ client: Arc<dyn HttpClient>,
+ credentials_provider: Arc<dyn CredentialsProvider>,
+ configuration: CopilotChatConfiguration,
+ cx: &mut App,
+) {
let copilot_chat =
cx.new(|cx| CopilotChat::new(client, credentials_provider, configuration, cx));
cx.set_global(GlobalCopilotChat(copilot_chat));
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index 13822a42fbe..90ffe03b9f8 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -225,6 +225,7 @@ web_search_providers.workspace = true
which_key.workspace = true
workspace.workspace = true
zed_actions.workspace = true
+zed_credentials_provider.workspace = true
zed_env_vars.workspace = true
zlog.workspace = true
zlog_settings.workspace = true
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 6d8ccf98dca..971599e2acf 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -680,8 +680,10 @@ fn main() {
.enterprise_uri
.clone(),
};
+ let credentials_provider = zed_credentials_provider::global(cx);
copilot_chat::init(
app_state.client.http_client(),
+ credentials_provider,
copilot_chat_configuration,
cx,
);
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index 11aef1415ab..d1302e75e28 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -6025,8 +6025,10 @@ mod tests {
project_panel::init(cx);
outline_panel::init(cx);
terminal_view::init(cx);
+ let credentials_provider = zed_credentials_provider::global(cx);
copilot_chat::init(
app_state.client.http_client(),
+ credentials_provider,
copilot_chat::CopilotChatConfiguration::default(),
cx,
);