Remove cx from ThemeSettings (#38836)

Before this change the active theme and icon theme were retrofitted onto
the ThemeSettings.

Now they're in their own new global (GlobalTheme::theme(cx) and
GlobalTheme::icon_theme(cx))

This lets us remove cx from the settings traits, and tidy up a few other
things along the way.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin
2025-10-06 23:06:50 +00:00
committed by GitHub
parent 4de13e06ec
commit a2a7bd139a
60 changed files with 360 additions and 423 deletions
+3 -5
View File
@@ -14,7 +14,7 @@ use feature_flags::FeatureFlagAppExt as _;
use fs::{Fs, RemoveOptions, RenameOptions};
use futures::StreamExt as _;
use gpui::{
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task,
AppContext as _, AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task,
};
use http_client::github::AssetKind;
use node_runtime::NodeRuntime;
@@ -22,7 +22,7 @@ use remote::RemoteClient;
use rpc::{AnyProtoClient, TypedEnvelope, proto};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{SettingsContent, SettingsStore};
use settings::SettingsStore;
use util::{ResultExt as _, debug_panic};
use crate::ProjectEnvironment;
@@ -1294,7 +1294,7 @@ impl From<settings::CustomAgentServerSettings> for CustomAgentServerSettings {
}
impl settings::Settings for AllAgentServersSettings {
fn from_settings(content: &settings::SettingsContent, _cx: &mut App) -> Self {
fn from_settings(content: &settings::SettingsContent) -> Self {
let agent_settings = content.agent_servers.clone().unwrap();
Self {
gemini: agent_settings.gemini.map(Into::into),
@@ -1307,6 +1307,4 @@ impl settings::Settings for AllAgentServersSettings {
.collect(),
}
}
fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut SettingsContent) {}
}
+1 -1
View File
@@ -980,7 +980,7 @@ pub struct DisableAiSettings {
}
impl settings::Settings for DisableAiSettings {
fn from_settings(content: &settings::SettingsContent, _cx: &mut App) -> Self {
fn from_settings(content: &settings::SettingsContent) -> Self {
Self {
disable_ai: content.disable_ai.unwrap().0,
}
+2 -2
View File
@@ -4,7 +4,7 @@ use context_server::ContextServerCommand;
use dap::adapters::DebugAdapterName;
use fs::Fs;
use futures::StreamExt as _;
use gpui::{App, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Subscription, Task};
use gpui::{AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Subscription, Task};
use lsp::LanguageServerName;
use paths::{
EDITORCONFIG_NAME, local_debug_file_relative_path, local_settings_file_relative_path,
@@ -437,7 +437,7 @@ pub struct LspPullDiagnosticsSettings {
}
impl Settings for ProjectSettings {
fn from_settings(content: &settings::SettingsContent, _cx: &mut App) -> Self {
fn from_settings(content: &settings::SettingsContent) -> Self {
let project = &content.project.clone();
let diagnostics = content.diagnostics.as_ref().unwrap();
let lsp_pull_diagnostics = diagnostics.lsp_pull_diagnostics.as_ref().unwrap();