mirror of
https://github.com/sharkdp/bat
synced 2024-11-15 00:27:10 +00: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
1 changed files with 1 additions and 6 deletions
|
@ -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 a new issue