feat: syntax highlighting for diff view

This commit is contained in:
2026-05-25 00:08:22 +01:00
parent b3e041a257
commit a6cf96ea96
20 changed files with 1295 additions and 722 deletions

View File

@@ -1,7 +1,11 @@
mod catppuccin;
pub(crate) mod syntax;
use gpui::Rgba;
#[allow(unused_imports)]
pub use syntax::{HIGHLIGHT_NAMES, ThemeSyntax, ThemeSyntaxHighlight};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ThemeMode {
Light,
@@ -15,6 +19,7 @@ pub struct Theme {
pub name: &'static str,
pub mode: ThemeMode,
pub colors: ThemeColors,
pub syntax: ThemeSyntax,
}
impl Default for Theme {
@@ -103,7 +108,7 @@ impl ThemeFamily {
}
}
pub const fn theme(self, mode: ThemeMode) -> Theme {
pub fn theme(self, mode: ThemeMode) -> Theme {
self.variant(mode).theme()
}
@@ -144,7 +149,7 @@ impl ThemeVariant {
}
}
pub const fn theme(self) -> Theme {
pub fn theme(self) -> Theme {
match self {
| Self::CatppuccinLatte => catppuccin::latte(),
| Self::CatppuccinMocha => catppuccin::mocha(),