copilot: Move enterprise URI to top-level setting (#65082)

This PR is moving the `enterprise` URI to a top level `copilot` settings
because it is used for both Edit Predictions and Copilot Chat.
Previously it was listed under `languages > copilot > enterprise_uri`

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner
2026-10-02 11:22:04 +00:00
committed by GitHub
parent 3209c7d31f
commit 309f91f564
18 changed files with 217 additions and 68 deletions
Generated
-2
View File
@@ -5548,7 +5548,6 @@ dependencies = [
"codestral",
"command_palette_hooks",
"copilot",
"copilot_chat",
"copilot_ui",
"edit_prediction",
"edit_prediction_types",
@@ -9785,7 +9784,6 @@ dependencies = [
"gpui",
"gpui_tokio",
"http_client",
"language",
"language_model",
"language_models_cloud",
"llama_cpp",
+4 -2
View File
@@ -1932,7 +1932,6 @@
"mode": "eager",
// Copilot-specific settings
// "copilot": {
// "enterprise_uri": "",
// "proxy": "",
// "proxy_no_verify": false,
// "enable_next_edit_suggestions": true,
@@ -1941,7 +1940,6 @@
// "prediction_debounce": 75
// },
"copilot": {
"enterprise_uri": null,
"proxy": null,
"proxy_no_verify": null,
"enable_next_edit_suggestions": true,
@@ -2640,6 +2638,10 @@
"language_servers": ["zls", "..."],
},
},
// Settings shared by Copilot Chat and edit predictions.
"copilot": {
"enterprise_uri": null,
},
// Different settings for specific language models.
"language_models": {
"anthropic": {
+6 -14
View File
@@ -15,7 +15,7 @@ use gpui::{
App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Subscription,
Task, WeakEntity, actions,
};
use language::language_settings::{AllLanguageSettings, CopilotSettings};
use language::language_settings::{AllLanguageSettings, CopilotEditPredictionSettings};
use language::{
Anchor, Bias, Buffer, BufferSnapshot, Language, PointUtf16, ToPointUtf16,
language_settings::{EditPredictionProvider, all_language_settings},
@@ -479,7 +479,10 @@ impl Copilot {
cx.notify();
}
fn build_env(&self, copilot_settings: &CopilotSettings) -> Option<HashMap<String, String>> {
fn build_env(
&self,
copilot_settings: &CopilotEditPredictionSettings,
) -> Option<HashMap<String, String>> {
let proxy_url = copilot_settings.proxy.clone()?;
let no_verify = copilot_settings.proxy_no_verify;
let http_or_https_proxy = if proxy_url.starts_with("http:") {
@@ -1311,24 +1314,13 @@ fn notify_did_change_config_to_server(
.copilot
.clone();
if let Some(copilot_chat) = copilot_chat::CopilotChat::global(cx) {
copilot_chat.update(cx, |chat, cx| {
chat.set_configuration(
copilot_chat::CopilotChatConfiguration {
enterprise_uri: copilot_settings.enterprise_uri.clone(),
},
cx,
);
});
}
let settings = json!({
"http": {
"proxy": copilot_settings.proxy,
"proxyStrictSSL": !copilot_settings.proxy_no_verify.unwrap_or(false)
},
"github-enterprise": {
"uri": copilot_settings.enterprise_uri
"uri": settings::CopilotSettings::get_global(cx).enterprise_uri
}
});
-1
View File
@@ -20,7 +20,6 @@ cloud_llm_client.workspace = true
codestral.workspace = true
command_palette_hooks.workspace = true
copilot.workspace = true
copilot_chat.workspace = true
copilot_ui.workspace = true
edit_prediction_types.workspace = true
edit_prediction.workspace = true
@@ -1036,14 +1036,11 @@ impl EditPredictionButton {
.copilot
.enable_next_edit_suggestions
.unwrap_or(true);
let copilot_config = copilot_chat::CopilotChatConfiguration {
enterprise_uri: all_language_settings
.edit_predictions
.copilot
let settings_url = copilot_settings_url(
settings::CopilotSettings::get_global(cx)
.enterprise_uri
.clone(),
};
let settings_url = copilot_settings_url(copilot_config.enterprise_uri.as_deref());
.as_deref(),
);
ContextMenu::build(window, cx, |menu, window, cx| {
let menu = self.build_language_settings_menu(menu, window, cx);
@@ -1809,18 +1806,15 @@ mod tests {
cx.update_global(|settings_store: &mut SettingsStore, cx| {
settings_store
.set_user_settings(
r#"{"edit_predictions":{"copilot":{"enterprise_uri":"https://my-company.ghe.com"}}}"#,
r#"{"copilot":{"enterprise_uri":"https://my-company.ghe.com"}}"#,
cx,
)
.unwrap();
});
let url = cx.update(|cx| {
let all_language_settings = all_language_settings(None, cx);
copilot_settings_url(
all_language_settings
.edit_predictions
.copilot
settings::CopilotSettings::get_global(cx)
.enterprise_uri
.as_deref(),
)
@@ -1839,18 +1833,15 @@ mod tests {
cx.update_global(|settings_store: &mut SettingsStore, cx| {
settings_store
.set_user_settings(
r#"{"edit_predictions":{"copilot":{"enterprise_uri":"https://my-company.ghe.com/"}}}"#,
r#"{"copilot":{"enterprise_uri":"https://my-company.ghe.com/"}}"#,
cx,
)
.unwrap();
});
let url = cx.update(|cx| {
let all_language_settings = all_language_settings(None, cx);
copilot_settings_url(
all_language_settings
.edit_predictions
.copilot
settings::CopilotSettings::get_global(cx)
.enterprise_uri
.as_deref(),
)
@@ -1867,11 +1858,8 @@ mod tests {
});
let url = cx.update(|cx| {
let all_language_settings = all_language_settings(None, cx);
copilot_settings_url(
all_language_settings
.edit_predictions
.copilot
settings::CopilotSettings::get_global(cx)
.enterprise_uri
.as_deref(),
)
+3 -6
View File
@@ -525,7 +525,7 @@ pub struct EditPredictionSettings {
/// Configures how edit predictions are displayed in the buffer.
pub mode: settings::EditPredictionsMode,
/// Settings specific to GitHub Copilot.
pub copilot: CopilotSettings,
pub copilot: CopilotEditPredictionSettings,
/// Settings specific to Codestral.
pub codestral: CodestralSettings,
/// Settings specific to Ollama.
@@ -598,13 +598,11 @@ pub struct DisabledGlob {
}
#[derive(Clone, Debug, Default)]
pub struct CopilotSettings {
pub struct CopilotEditPredictionSettings {
/// HTTP/HTTPS proxy to use for Copilot.
pub proxy: Option<String>,
/// Disable certificate verification for proxy (not recommended).
pub proxy_no_verify: Option<bool>,
/// Enterprise URI for Copilot.
pub enterprise_uri: Option<String>,
/// Whether the Copilot Next Edit Suggestions feature is enabled.
pub enable_next_edit_suggestions: Option<bool>,
/// Automatic prediction debounce delay.
@@ -955,10 +953,9 @@ impl settings::Settings for AllLanguageSettings {
.collect();
let copilot = edit_predictions.copilot.unwrap();
let copilot_settings = CopilotSettings {
let copilot_settings = CopilotEditPredictionSettings {
proxy: copilot.proxy,
proxy_no_verify: copilot.proxy_no_verify,
enterprise_uri: copilot.enterprise_uri,
enable_next_edit_suggestions: copilot.enable_next_edit_suggestions,
prediction_debounce: copilot.prediction_debounce.unwrap(),
};
-1
View File
@@ -43,7 +43,6 @@ google_ai = { workspace = true, features = ["schemars"] }
gpui.workspace = true
gpui_tokio.workspace = true
http_client.workspace = true
language.workspace = true
language_model.workspace = true
language_models_cloud.workspace = true
llama_cpp = { workspace = true, features = ["schemars"] }
@@ -6,14 +6,13 @@ use copilot_chat::{
};
use futures::{FutureExt as _, future::BoxFuture};
use gpui::{App, AsyncApp, Entity, Subscription, Task};
use language::language_settings::all_language_settings;
use language_model::{
AuthenticateError, IconOrSvg, LanguageModel, LanguageModelClient, LanguageModelCompletionError,
LanguageModelCompletionStream, LanguageModelProvider, LanguageModelProviderId,
LanguageModelProviderName, LanguageModelProviderState, LanguageModelRequest, ModelRateLimiters,
ProviderSettingsView, unavailable_error,
};
use settings::SettingsStore;
use settings::{CopilotSettings, Settings, SettingsStore};
use ui::prelude::*;
pub struct CopilotChatLanguageModelProvider {
@@ -43,13 +42,8 @@ impl CopilotChatLanguageModelProvider {
_copilot_chat_subscription: copilot_chat_subscription,
_settings_subscription: cx.observe_global::<SettingsStore>(|_, cx| {
if let Some(copilot_chat) = CopilotChat::global(cx) {
let language_settings = all_language_settings(None, cx);
let configuration = CopilotChatConfiguration {
enterprise_uri: language_settings
.edit_predictions
.copilot
.enterprise_uri
.clone(),
enterprise_uri: CopilotSettings::get_global(cx).enterprise_uri.clone(),
};
copilot_chat.update(cx, |chat, cx| {
chat.set_configuration(configuration, cx);
+6
View File
@@ -382,3 +382,9 @@ pub(crate) mod m_2026_09_16 {
pub(crate) use settings::nest_agent_threads_sidebar_settings;
}
pub(crate) mod m_2026_09_29 {
mod settings;
pub(crate) use settings::move_copilot_enterprise_uri;
}
@@ -0,0 +1,104 @@
use anyhow::Result;
use serde_json::{Map, Value};
use crate::migrations::migrate_settings;
pub fn move_copilot_enterprise_uri(value: &mut Value) -> Result<()> {
migrate_settings(value, &mut migrate_one)
}
fn migrate_one(settings: &mut Map<String, Value>) -> Result<()> {
if settings
.get("copilot")
.is_some_and(|value| !value.is_object())
{
return Ok(());
}
let Some(edit_predictions) = settings
.get_mut("edit_predictions")
.and_then(Value::as_object_mut)
else {
return Ok(());
};
let Some(prediction_copilot) = edit_predictions
.get_mut("copilot")
.and_then(Value::as_object_mut)
else {
return Ok(());
};
let Some(enterprise_uri) = prediction_copilot.remove("enterprise_uri") else {
return Ok(());
};
if prediction_copilot.is_empty() {
edit_predictions.remove("copilot");
}
if edit_predictions.is_empty() {
settings.remove("edit_predictions");
}
let copilot = settings
.entry("copilot")
.or_insert_with(|| Value::Object(Map::new()));
if let Value::Object(copilot) = copilot {
copilot.entry("enterprise_uri").or_insert(enterprise_uri);
}
Ok(())
}
#[cfg(test)]
mod tests {
use serde_json::json;
use super::*;
#[test]
fn moves_enterprise_uri_in_all_settings_scopes_without_overwriting_existing_values() {
let legacy = json!({
"edit_predictions": {
"copilot": { "enterprise_uri": "https://legacy.example", "other": true },
"provider": "copilot"
}
});
let mut value = json!({
"edit_predictions": legacy["edit_predictions"],
"macos": legacy,
"preview": legacy,
"profiles": {
"direct": legacy,
"wrapped": { "settings": legacy },
"existing": {
"settings": {
"edit_predictions": { "copilot": { "enterprise_uri": "https://legacy.example" } },
"copilot": { "enterprise_uri": null, "other": true }
}
}
}
});
move_copilot_enterprise_uri(&mut value).expect("migration should succeed");
for scope in [
&value,
&value["macos"],
&value["preview"],
&value["profiles"]["direct"],
&value["profiles"]["wrapped"]["settings"],
] {
assert_eq!(scope["copilot"]["enterprise_uri"], "https://legacy.example");
assert_eq!(
scope["edit_predictions"],
json!({
"copilot": { "other": true },
"provider": "copilot"
})
);
}
assert_eq!(
value["profiles"]["existing"]["settings"],
json!({
"copilot": { "enterprise_uri": null, "other": true }
})
);
}
}
+32
View File
@@ -257,6 +257,7 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
MigrationType::Json(migrations::m_2026_08_26::rename_folder_icons_to_folder_indicator),
MigrationType::Json(migrations::m_2026_08_30::nest_markdown_preview_settings),
MigrationType::Json(migrations::m_2026_09_16::nest_agent_threads_sidebar_settings),
MigrationType::Json(migrations::m_2026_09_29::move_copilot_enterprise_uri),
];
run_migrations(text, migrations)
}
@@ -465,6 +466,37 @@ mod tests {
assert_migrate_settings("", None)
}
#[test]
fn test_copilot_enterprise_uri_migration_does_not_restore_deleted_destination() {
let input = r#"{
// Keep this comment.
"edit_predictions": { "copilot": { "enterprise_uri": "https://enterprise.example" } }
}"#;
let migrated = migrate_settings(input)
.expect("migration should succeed")
.expect("settings should change");
assert!(migrated.contains("// Keep this comment."));
let value: serde_json_lenient::Value =
parse_json_with_comments(&migrated).expect("migrated settings should parse");
let value = serde_json::to_value(value).expect("settings should convert to JSON");
assert_eq!(
value["copilot"]["enterprise_uri"],
"https://enterprise.example"
);
assert!(value.get("edit_predictions").is_none());
let mut value = value;
value
.as_object_mut()
.expect("settings should be an object")
.remove("copilot");
let without_destination = serde_json::to_string(&value).expect("settings should serialize");
assert_eq!(
migrate_settings(&without_destination).expect("migration should succeed"),
None
);
}
#[test]
fn test_replace_array_with_single_string() {
assert_migrate_keymap(
+17
View File
@@ -26,6 +26,7 @@ pub mod private {
use gpui::{App, Global};
use crate as settings;
use std::env;
use std::{borrow::Cow, fmt, str};
use util::asset_str;
@@ -54,6 +55,22 @@ pub use vscode_import::{VsCodeSettings, VsCodeSettingsSource};
pub use keymap_file::ActionSequence;
#[derive(Clone, Debug, Default, RegisterSetting)]
pub struct CopilotSettings {
pub enterprise_uri: Option<String>,
}
impl Settings for CopilotSettings {
fn from_settings(content: &SettingsContent) -> Self {
Self {
enterprise_uri: content
.copilot
.as_ref()
.and_then(|copilot| copilot.enterprise_uri.clone()),
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct ActiveSettingsProfileName(pub String);
+1
View File
@@ -193,6 +193,7 @@ impl VsCodeSettings {
.map(|history| CommandPaletteSettingsContent {
use_command_history: Some(history > 0),
}),
copilot: None,
credentials_url: None,
debugger: None,
diagnostics: None,
+10 -5
View File
@@ -160,7 +160,7 @@ pub struct EditPredictionSettingsContent {
/// Provider support required.
pub mode: Option<EditPredictionsMode>,
/// Settings specific to GitHub Copilot.
pub copilot: Option<CopilotSettingsContent>,
pub copilot: Option<CopilotEditPredictionSettingsContent>,
/// Settings specific to Codestral.
pub codestral: Option<CodestralSettingsContent>,
/// Settings specific to Ollama.
@@ -241,6 +241,15 @@ pub enum EditPredictionPromptFormatContent {
#[with_fallible_options]
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
pub struct CopilotSettingsContent {
/// Enterprise URI shared by Copilot Chat and edit predictions.
///
/// Default: none
pub enterprise_uri: Option<String>,
}
#[with_fallible_options]
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
pub struct CopilotEditPredictionSettingsContent {
/// HTTP/HTTPS proxy to use for Copilot.
///
/// Default: none
@@ -249,10 +258,6 @@ pub struct CopilotSettingsContent {
///
/// Default: false
pub proxy_no_verify: Option<bool>,
/// Enterprise URI for Copilot.
///
/// Default: none
pub enterprise_uri: Option<String>,
/// Whether the Copilot Next Edit Suggestions feature is enabled.
///
/// Default: true
@@ -270,6 +270,8 @@ pub struct SettingsContent {
pub language_models: Option<AllLanguageModelSettingsContent>,
pub copilot: Option<CopilotSettingsContent>,
pub outline_panel: Option<OutlinePanelSettingsContent>,
pub project_panel: Option<ProjectPanelSettingsContent>,
@@ -406,7 +408,7 @@ fallible_options::flattened_deserialize!(SettingsContent {
agent_servers, audio, auto_update, base_keymap, collaboration_panel, debugger, diagnostics,
git,
global_lsp_settings, image_viewer, markdown_preview, repl, helix_mode, hide_mouse,
journal, log, line_indicator_format, language_models, outline_panel, project_panel,
journal, log, line_indicator_format, language_models, copilot, outline_panel, project_panel,
node, proxy, reduce_motion, server_url, credentials_url, session, telemetry, terminal,
title_bar, vim_mode, calls, which_key, vim, modeline_lines, feature_flags,
instrumentation,
+1 -3
View File
@@ -676,9 +676,7 @@ fn main() {
);
command_palette::init(cx);
let copilot_chat_configuration = copilot_chat::CopilotChatConfiguration {
enterprise_uri: language::language_settings::all_language_settings(None, cx)
.edit_predictions
.copilot
enterprise_uri: settings::CopilotSettings::get_global(cx)
.enterprise_uri
.clone(),
};
+3 -4
View File
@@ -255,16 +255,15 @@ If your organization uses GitHub Copilot Enterprise, you can configure Zed to us
```json [settings]
{
"edit_predictions": {
"copilot": {
"enterprise_uri": "https://your.enterprise.domain"
}
"copilot": {
"enterprise_uri": "https://your.enterprise.domain"
}
}
```
Replace `"https://your.enterprise.domain"` with the URL provided by your GitHub Enterprise administrator (e.g., `https://foo.ghe.com`).
This setting applies to both Copilot edit predictions and Copilot Chat.
Once set, Zed routes Copilot requests through your enterprise endpoint.
When you sign in by clicking the Copilot icon in the status bar, you are redirected to your configured enterprise URL to complete authentication.
All other Copilot features and usage remain the same.
@@ -38,6 +38,22 @@ GitHub Copilot can be used as a Copilot Chat model provider for Zed AI features
If you use a Copilot agent or CLI, that setup is owned by Copilot. See [External Agents](./external-agents.md) and [Terminal Threads](./terminal-threads.md).
### GitHub Copilot Enterprise {#copilot-enterprise}
To use your enterprise instance for Copilot Chat and edit predictions, add this to your settings file ([how to edit](../configuring-zed.md#settings-files)):
```json [settings]
{
"copilot": {
"enterprise_uri": "https://your.enterprise.domain"
}
}
```
Replace `"https://your.enterprise.domain"` with the URL provided by your GitHub Enterprise administrator (for example, `https://foo.ghe.com`).
This setting also controls [Copilot edit predictions](./edit-prediction.md#using-github-copilot-enterprise).
## OpenCode Zen / Go {#opencode}
OpenCode is a first-class language model provider in Zed. If you think of Zen or Go as your OpenCode subscription, the Zed setup path is still [Use API Access](./use-api-access.md#opencode): enter an OpenCode API key, then choose which OpenCode models to show. Zed does not sign in to OpenCode with OAuth or detect your subscription directly.