WIP – Add Syntax themes to importer
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This commit is contained in:
co-authored by
Marshall Bowers
parent
4b5ca3e420
commit
efd1db1b09
@@ -2,8 +2,8 @@ use std::fmt::{self, Debug};
|
||||
|
||||
use gpui::{Hsla, Rgba};
|
||||
use theme::{
|
||||
Appearance, PlayerColor, PlayerColors, StatusColors, StatusColorsRefinement, SyntaxTheme,
|
||||
SystemColors, ThemeColorsRefinement, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
|
||||
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, SystemColors,
|
||||
ThemeColorsRefinement, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
|
||||
};
|
||||
|
||||
struct RawSyntaxPrinter<'a>(&'a str);
|
||||
@@ -30,6 +30,17 @@ impl<'a, D: Debug> Debug for IntoPrinter<'a, D> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct OptionPrinter<'a, T>(&'a Option<T>);
|
||||
|
||||
impl<'a, T: Debug> Debug for OptionPrinter<'a, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {
|
||||
Some(value) => write!(f, "Some({:?})", value),
|
||||
None => write!(f, "None"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VecPrinter<'a, T>(&'a Vec<T>);
|
||||
|
||||
impl<'a, T: Debug> Debug for VecPrinter<'a, T> {
|
||||
@@ -93,6 +104,16 @@ impl<'a> Debug for UserThemeStylesRefinementPrinter<'a> {
|
||||
f.debug_struct("UserThemeStylesRefinement")
|
||||
.field("colors", &ThemeColorsRefinementPrinter(&self.0.colors))
|
||||
.field("status", &StatusColorsRefinementPrinter(&self.0.status))
|
||||
.field(
|
||||
"syntax",
|
||||
&OptionPrinter(
|
||||
&self
|
||||
.0
|
||||
.syntax
|
||||
.as_ref()
|
||||
.map(|syntax| UserSyntaxThemePrinter(syntax)),
|
||||
),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
@@ -316,11 +337,11 @@ impl<'a> Debug for PlayerColorPrinter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SyntaxThemePrinter<'a>(&'a SyntaxTheme);
|
||||
pub struct UserSyntaxThemePrinter<'a>(&'a UserSyntaxTheme);
|
||||
|
||||
impl<'a> Debug for SyntaxThemePrinter<'a> {
|
||||
impl<'a> Debug for UserSyntaxThemePrinter<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("SyntaxTheme")
|
||||
f.debug_struct("UserSyntaxTheme")
|
||||
.field(
|
||||
"highlights",
|
||||
&VecPrinter(
|
||||
|
||||
Reference in New Issue
Block a user