From a7ca17fcb220891193bd08af113e178d755f4d6a Mon Sep 17 00:00:00 2001
From: Pranav Nedungadi <59979143+npv12@users.noreply.github.com>
Date: Mon, 20 Apr 2026 18:25:07 +0530
Subject: [PATCH] edit_prediction_ui: Add configure providers menu item to
Copilot and Codestral (#53691)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Codestral and copilot has a custom menu being built out. While the
common menu has the configure provider quick setting, the custom menu
doesn't have them. however it is a neat feature to have and quickly
switch it out.
Furthermore, copilot has an option of "Use zed AI" when copilot isn't
signed in. Instead add the complete list and configure provider when it
is not signed in
Before
After
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Closes NA
Release Notes:
- added configure provider menu item to copilot and codestral
---------
Signed-off-by: Pranav
Co-authored-by: Ben Kunkle
---
.../src/edit_prediction_button.rs | 108 +++++++++---------
1 file changed, 57 insertions(+), 51 deletions(-)
diff --git a/crates/edit_prediction_ui/src/edit_prediction_button.rs b/crates/edit_prediction_ui/src/edit_prediction_button.rs
index d6772847ffb861038ee581bebac05bdf07118d9f..7f9415763de55439e081dff72cabe09770ae5c85 100644
--- a/crates/edit_prediction_ui/src/edit_prediction_button.rs
+++ b/crates/edit_prediction_ui/src/edit_prediction_button.rs
@@ -630,6 +630,28 @@ impl EditPredictionButton {
menu
}
+ fn add_configure_providers_item(&self, menu: ContextMenu) -> ContextMenu {
+ menu.separator().item(
+ ContextMenuEntry::new("Configure Providers")
+ .icon(IconName::Settings)
+ .icon_position(IconPosition::Start)
+ .icon_color(Color::Muted)
+ .handler(move |window, cx| {
+ telemetry::event!(
+ "Edit Prediction Menu Action",
+ action = "configure_providers",
+ );
+ window.dispatch_action(
+ OpenSettingsAt {
+ path: "edit_predictions.providers".to_string(),
+ }
+ .boxed_clone(),
+ cx,
+ );
+ }),
+ )
+ }
+
pub fn build_copilot_start_menu(
&mut self,
window: &mut Window,
@@ -637,39 +659,38 @@ impl EditPredictionButton {
) -> Entity {
let fs = self.fs.clone();
let project = self.project.clone();
- ContextMenu::build(window, cx, |menu, _, _| {
- menu.entry("Sign In to Copilot", None, move |window, cx| {
- telemetry::event!(
- "Edit Prediction Menu Action",
- action = "sign_in",
- provider = "copilot",
- );
- if let Some(copilot) = EditPredictionStore::try_global(cx).and_then(|store| {
- store.update(cx, |this, cx| {
- this.start_copilot_for_project(&project.upgrade()?, cx)
- })
- }) {
- copilot_ui::initiate_sign_in(copilot, window, cx);
- }
- })
- .entry("Disable Copilot", None, {
- let fs = fs.clone();
- move |_window, cx| {
+ ContextMenu::build(window, cx, |menu, _, cx| {
+ let menu = menu
+ .entry("Sign In to Copilot", None, move |window, cx| {
telemetry::event!(
"Edit Prediction Menu Action",
- action = "disable_provider",
+ action = "sign_in",
provider = "copilot",
);
- hide_copilot(fs.clone(), cx)
- }
- })
- .separator()
- .entry("Use Zed AI", None, {
- let fs = fs.clone();
- move |_window, cx| {
- set_completion_provider(fs.clone(), cx, EditPredictionProvider::Zed)
- }
- })
+ if let Some(copilot) = EditPredictionStore::try_global(cx).and_then(|store| {
+ store.update(cx, |this, cx| {
+ this.start_copilot_for_project(&project.upgrade()?, cx)
+ })
+ }) {
+ copilot_ui::initiate_sign_in(copilot, window, cx);
+ }
+ })
+ .entry("Disable Copilot", None, {
+ let fs = fs.clone();
+ move |_window, cx| {
+ telemetry::event!(
+ "Edit Prediction Menu Action",
+ action = "disable_provider",
+ provider = "copilot",
+ );
+ hide_copilot(fs.clone(), cx)
+ }
+ });
+
+ let menu =
+ self.add_provider_switching_section(menu, EditPredictionProvider::Copilot, cx);
+ let menu = self.add_configure_providers_item(menu);
+ menu
})
}
@@ -1008,7 +1029,9 @@ impl EditPredictionButton {
let menu =
self.add_provider_switching_section(menu, EditPredictionProvider::Copilot, cx);
- menu.separator()
+ let menu = self.add_configure_providers_item(menu);
+ let menu = menu
+ .separator()
.item(
ContextMenuEntry::new("Copilot: Next Edit Suggestions")
.toggleable(IconPosition::Start, next_edit_suggestions)
@@ -1034,7 +1057,8 @@ impl EditPredictionButton {
"Go to Copilot Settings",
OpenBrowser { url: settings_url }.boxed_clone(),
)
- .action("Sign Out", copilot::SignOut.boxed_clone())
+ .action("Sign Out", copilot::SignOut.boxed_clone());
+ menu
})
}
@@ -1048,6 +1072,7 @@ impl EditPredictionButton {
let menu =
self.add_provider_switching_section(menu, EditPredictionProvider::Codestral, cx);
+ let menu = self.add_configure_providers_item(menu);
menu
})
}
@@ -1290,26 +1315,7 @@ impl EditPredictionButton {
}
}
- menu = menu.separator().item(
- ContextMenuEntry::new("Configure Providers")
- .icon(IconName::Settings)
- .icon_position(IconPosition::Start)
- .icon_color(Color::Muted)
- .handler(move |window, cx| {
- telemetry::event!(
- "Edit Prediction Menu Action",
- action = "configure_providers",
- );
- window.dispatch_action(
- OpenSettingsAt {
- path: "edit_predictions.providers".to_string(),
- }
- .boxed_clone(),
- cx,
- );
- }),
- );
-
+ let menu = self.add_configure_providers_item(menu);
menu
})
}