refactor: clean up highlight module, remove unused theme getters and imports
This commit is contained in:
parent
11261836c7
commit
2e1d05cb03
@ -2,23 +2,12 @@
|
|||||||
pub mod server {
|
pub mod server {
|
||||||
use std::sync::{LazyLock, OnceLock};
|
use std::sync::{LazyLock, OnceLock};
|
||||||
|
|
||||||
use syntect::highlighting::{Theme, ThemeSet};
|
|
||||||
use syntect::html::{ClassedHTMLGenerator, ClassStyle};
|
use syntect::html::{ClassedHTMLGenerator, ClassStyle};
|
||||||
use syntect::parsing::{SyntaxReference, SyntaxSet};
|
use syntect::parsing::{SyntaxReference, SyntaxSet};
|
||||||
use syntect::util::LinesWithEndings;
|
use syntect::util::LinesWithEndings;
|
||||||
|
|
||||||
static SYNTAX_SET: LazyLock<SyntaxSet> =
|
static SYNTAX_SET: LazyLock<SyntaxSet> =
|
||||||
LazyLock::new(|| SyntaxSet::load_defaults_newlines());
|
LazyLock::new(SyntaxSet::load_defaults_newlines);
|
||||||
|
|
||||||
static LATTE_THEME: LazyLock<Theme> = LazyLock::new(|| {
|
|
||||||
ThemeSet::get_theme("themes/Catppuccin Latte.tmTheme")
|
|
||||||
.expect("Failed to load Catppuccin Latte theme")
|
|
||||||
});
|
|
||||||
|
|
||||||
static MOCHA_THEME: LazyLock<Theme> = LazyLock::new(|| {
|
|
||||||
ThemeSet::get_theme("themes/Catppuccin Mocha.tmTheme")
|
|
||||||
.expect("Failed to load Catppuccin Mocha theme")
|
|
||||||
});
|
|
||||||
|
|
||||||
static FALLBACK_SYNTAX: OnceLock<SyntaxReference> = OnceLock::new();
|
static FALLBACK_SYNTAX: OnceLock<SyntaxReference> = OnceLock::new();
|
||||||
|
|
||||||
@ -53,16 +42,4 @@ pub mod server {
|
|||||||
|
|
||||||
generator.finalize()
|
generator.finalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_latte_theme() -> &'static Theme {
|
|
||||||
&*LATTE_THEME
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_mocha_theme() -> &'static Theme {
|
|
||||||
&*MOCHA_THEME
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_syntax_set() -> &'static SyntaxSet {
|
|
||||||
&*SYNTAX_SET
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user