mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-29 00:48:37 +01:00
HighlightingAssets: Implement get_syntax_for_file_name() with get_syntax_for_path()
We can do this since the file_name() of a file_name is file_name.
This commit is contained in:
parent
b69ab219d7
commit
ad98d35a48
@ -159,12 +159,7 @@ impl HighlightingAssets {
|
||||
file_name: impl AsRef<Path>,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let file_name = file_name.as_ref();
|
||||
Ok(match mapping.get_syntax_for(file_name) {
|
||||
Some(MappingTarget::MapToUnknown) => None,
|
||||
Some(MappingTarget::MapTo(syntax_name)) => self.find_syntax_by_name(syntax_name)?,
|
||||
None => self.get_extension_syntax(file_name.as_os_str())?,
|
||||
})
|
||||
Ok(self.get_syntax_for_path(file_name.as_ref(), mapping).ok())
|
||||
}
|
||||
|
||||
fn get_syntax_for_path(
|
||||
|
Loading…
Reference in New Issue
Block a user