theme: Don't log errors for missing themes until extensions have loaded (#25098)

This PR makes it so we don't log errors for missing themes or icon
themes until after the extensions have been loaded.

Currently, if you are using a theme that is defined in an extension it
is common to see one or more "theme not found" errors in the logs. This
is the result of us having to initialize the theme before the extensions
have actually finished loading.

This means that a theme that _may_ exist once extensions load is
considered non-existent before they have loaded.

To that end, we now wait until the extensions have loaded before we
start logging errors if we can't find the theme or icon theme.

Closes https://github.com/zed-industries/zed/issues/24539.

Release Notes:

- Reduced the number of "theme not found" and "icon theme not found"
errors in the logs for themes provided by extensions.
This commit is contained in:
Marshall Bowers 2025-02-18 12:47:25 -05:00 committed by GitHub
parent 1e255e41cc
commit c10ac31866
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 45 additions and 7 deletions

View file

@ -96,6 +96,8 @@ impl ExtensionHostProxy {
}
pub trait ExtensionThemeProxy: Send + Sync + 'static {
fn set_extensions_loaded(&self);
fn list_theme_names(&self, theme_path: PathBuf, fs: Arc<dyn Fs>) -> Task<Result<Vec<String>>>;
fn remove_user_themes(&self, themes: Vec<SharedString>);
@ -123,6 +125,14 @@ pub trait ExtensionThemeProxy: Send + Sync + 'static {
}
impl ExtensionThemeProxy for ExtensionHostProxy {
fn set_extensions_loaded(&self) {
let Some(proxy) = self.theme_proxy.read().clone() else {
return;
};
proxy.set_extensions_loaded()
}
fn list_theme_names(&self, theme_path: PathBuf, fs: Arc<dyn Fs>) -> Task<Result<Vec<String>>> {
let Some(proxy) = self.theme_proxy.read().clone() else {
return Task::ready(Ok(Vec::new()));