Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose syntect theme and syntax sets #2030

Merged
6 changes: 4 additions & 2 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ impl HighlightingAssets {
self.fallback_theme = Some(theme);
}

fn get_syntax_set(&self) -> Result<&SyntaxSet> {
/// Return the collection of syntect syntax definitions.
pub fn get_syntax_set(&self) -> Result<&SyntaxSet> {
self.syntax_set_cell
.get_or_try_init(|| self.serialized_syntax_set.deserialize())
}
Expand Down Expand Up @@ -186,7 +187,8 @@ impl HighlightingAssets {
}
}

pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
/// Look up a syntect theme by name.
pub fn get_theme(&self, theme: &str) -> &Theme {
match self.get_theme_set().get(theme) {
Some(theme) => theme,
None => {
Expand Down