1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-12 00:02:28 +01:00

Use --file-name to detect syntax highlighting

Closes #891
This commit is contained in:
Kyle Criddle
2020-03-26 16:49:16 -06:00
committed by David Peter
parent 96aedf6240
commit a3f8140fbe
3 changed files with 64 additions and 14 deletions

View File

@@ -112,6 +112,7 @@ impl<'a> InteractivePrinter<'a> {
config: &'a Config,
assets: &'a HighlightingAssets,
file: InputFile,
file_name: Option<&str>,
reader: &mut InputFileReader,
) -> Self {
let theme = assets.get_theme(&config.theme);
@@ -177,7 +178,13 @@ impl<'a> InteractivePrinter<'a> {
}
// Determine the type of syntax for highlighting
let syntax = assets.get_syntax(config.language, file, reader, &config.syntax_mapping);
let syntax = assets.get_syntax(
config.language,
file,
file_name,
reader,
&config.syntax_mapping,
);
Some(HighlightLines::new(syntax, theme))
};