1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-07 19:31:42 +00:00

Refactor HighlightingAssets::get_syntax to return Result type

This commit is contained in:
Ethan P
2020-05-15 17:52:33 -07:00
committed by David Peter
parent 9c371ed8a2
commit 5aa20c090b
3 changed files with 54 additions and 28 deletions
+4 -1
View File
@@ -164,7 +164,10 @@ impl<'a> InteractivePrinter<'a> {
None
} else {
// Determine the type of syntax for highlighting
let syntax = assets.get_syntax(config.language, input, &config.syntax_mapping);
let syntax = assets
.get_syntax(config.language, input, &config.syntax_mapping)
.unwrap_or_else(|_| assets.syntax_set.find_syntax_plain_text());
Some(HighlightLines::new(syntax, theme))
};