Merge remote-tracking branch 'origin/main' into editor-movement

This commit is contained in:
Antonio Scandurra
2023-11-07 18:48:08 +01:00
parent 2697862a02
commit d7e86eb1c1
14 changed files with 235 additions and 217 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
use std::sync::Arc;
use gpui::Hsla;
use refineable::Refineable;
@@ -145,7 +147,7 @@ pub struct ThemeStyles {
pub status: StatusColors,
pub git: GitStatusColors,
pub player: PlayerColors,
pub syntax: SyntaxTheme,
pub syntax: Arc<SyntaxTheme>,
}
#[cfg(test)]
+4
View File
@@ -138,6 +138,8 @@ impl SyntaxTheme {
("variable.special".into(), red().light().step_7().into()),
("variant".into(), red().light().step_7().into()),
],
inlay_style: tomato().light().step_1().into(), // todo!("nate: use a proper style")
suggestion_style: orange().light().step_1().into(), // todo!("nate: use proper style")
}
}
@@ -193,6 +195,8 @@ impl SyntaxTheme {
("variable.special".into(), red().dark().step_7().into()),
("variant".into(), red().dark().step_7().into()),
],
inlay_style: tomato().dark().step_1().into(), // todo!("nate: use a proper style")
suggestion_style: orange().dark().step_1().into(), // todo!("nate: use a proper style")
}
}
}
+4 -2
View File
@@ -1,3 +1,5 @@
use std::sync::Arc;
use crate::{
colors::{GitStatusColors, PlayerColors, StatusColors, SystemColors, ThemeColors, ThemeStyles},
default_color_scales, Appearance, SyntaxTheme, Theme, ThemeFamily,
@@ -14,7 +16,7 @@ fn zed_pro_daylight() -> Theme {
status: StatusColors::default(),
git: GitStatusColors::default(),
player: PlayerColors::default(),
syntax: SyntaxTheme::default_light(),
syntax: Arc::new(SyntaxTheme::default_light()),
},
}
}
@@ -30,7 +32,7 @@ pub(crate) fn zed_pro_moonlight() -> Theme {
status: StatusColors::default(),
git: GitStatusColors::default(),
player: PlayerColors::default(),
syntax: SyntaxTheme::default_dark(),
syntax: Arc::new(SyntaxTheme::default_dark()),
},
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ impl ThemeRegistry {
status: StatusColors::default(),
git: GitStatusColors::default(),
player: PlayerColors::default(),
syntax: SyntaxTheme::default_dark(),
syntax: Arc::new(SyntaxTheme::default_dark()),
},
}
}));
+4
View File
@@ -3,6 +3,8 @@ use gpui::{HighlightStyle, Hsla};
#[derive(Clone, Default)]
pub struct SyntaxTheme {
pub highlights: Vec<(String, HighlightStyle)>,
pub inlay_style: HighlightStyle,
pub suggestion_style: HighlightStyle,
}
impl SyntaxTheme {
@@ -21,6 +23,8 @@ impl SyntaxTheme {
)
})
.collect(),
inlay_style: HighlightStyle::default(),
suggestion_style: HighlightStyle::default(),
}
}
+22 -1
View File
@@ -77,7 +77,7 @@ impl Theme {
/// Returns the [`SyntaxTheme`] for the theme.
#[inline(always)]
pub fn syntax(&self) -> &SyntaxTheme {
pub fn syntax(&self) -> &Arc<SyntaxTheme> {
&self.styles.syntax
}
@@ -98,4 +98,25 @@ impl Theme {
pub fn syntax_color(&self, name: &str) -> Hsla {
self.syntax().color(name)
}
/// Returns the [`StatusColors`] for the theme.
#[inline(always)]
pub fn diagnostic_style(&self) -> DiagnosticStyle {
DiagnosticStyle {
error: self.status().error,
warning: self.status().warning,
info: self.status().info,
hint: self.status().info,
ignored: self.status().ignored,
}
}
}
#[derive(Clone, Debug)]
pub struct DiagnosticStyle {
pub error: Hsla,
pub warning: Hsla,
pub info: Hsla,
pub hint: Hsla,
pub ignored: Hsla,
}