theme: Turn ThemeRegistry into a trait (#20076)

This PR converts the `ThemeRegistry` type into a trait instead of a
concrete implementation.

This allows for the extension store to depend on an abstraction rather
than the concrete theme registry implementation.

We currently have two `ThemeRegistry` implementations:

- `RealThemeRegistry` — this was previously the `ThemeRegistry` and
contains the real implementation of the registry.
- `VoidThemeRegistry` — a null object that doesn't have any behavior.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-11-01 10:19:09 -04:00 committed by GitHub
parent c04c439d23
commit af9e7f1f96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 184 additions and 118 deletions

View file

@ -15,7 +15,6 @@ use extension::{
};
use language::LanguageConfig;
use reqwest_client::ReqwestClient;
use theme::ThemeRegistry;
use tree_sitter::{Language, Query, WasmStore};
#[derive(Parser, Debug)]
@ -267,7 +266,7 @@ async fn test_themes(
) -> Result<()> {
for relative_theme_path in &manifest.themes {
let theme_path = extension_path.join(relative_theme_path);
let theme_family = ThemeRegistry::read_user_theme(&theme_path, fs.clone()).await?;
let theme_family = theme::read_user_theme(&theme_path, fs.clone()).await?;
log::info!("loaded theme family {}", theme_family.name);
}