Remove old Theme definition (#3195)

This PR removes the old `Theme` definition in favor of the new
`ThemeVariant`s.

The new `SyntaxStyles` have been reverted to the old `SyntaxTheme` that
operates by storing the syntax styles as a vector of
`gpui2::HighlightStyle`s.

This is necessary for the intended usage by `language2`, where we find
the longest key in the theme's syntax styles that matches the capture
name:

https://github.com/zed-industries/zed/blob/18431051d9d750d9e66284a71f7a55a1e31c1374/crates/language2/src/highlight_map.rs#L15-L41
This commit is contained in:
Marshall Bowers
2023-10-31 23:05:50 -04:00
committed by GitHub
parent 18431051d9
commit 36a73d657a
54 changed files with 173 additions and 6832 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
use crate::{zed_pro_moonlight, Theme, ThemeRegistry, ThemeVariant};
use crate::{ThemeRegistry, ThemeVariant};
use anyhow::Result;
use gpui2::{px, AppContext, Font, FontFeatures, FontStyle, FontWeight, Pixels};
use schemars::{
@@ -21,7 +21,6 @@ pub struct ThemeSettings {
pub buffer_font_size: Pixels,
pub buffer_line_height: BufferLineHeight,
pub active_theme: Arc<ThemeVariant>,
pub old_active_theme: Arc<Theme>,
}
#[derive(Default)]
@@ -124,8 +123,9 @@ impl settings2::Settings for ThemeSettings {
},
buffer_font_size: defaults.buffer_font_size.unwrap().into(),
buffer_line_height: defaults.buffer_line_height.unwrap(),
active_theme: Arc::new(zed_pro_moonlight()),
old_active_theme: themes.get(defaults.theme.as_ref().unwrap()).unwrap(),
active_theme: themes.get("Zed Pro Moonlight").unwrap(),
// todo!(Read the theme name from the settings)
// active_theme: themes.get(defaults.theme.as_ref().unwrap()).unwrap(),
};
for value in user_values.into_iter().copied().cloned() {
@@ -138,7 +138,7 @@ impl settings2::Settings for ThemeSettings {
if let Some(value) = &value.theme {
if let Some(theme) = themes.get(value).log_err() {
this.old_active_theme = theme;
this.active_theme = theme;
}
}