diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92fad76de1..6adf469a36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## Features
+- Support for `--ignored-suffix` argument. See #1892 (@bojan88)
- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
- Support for `x:+delta` syntax in line ranges (e.g. `20:+10`). See #1810 (@bojan88)
diff --git a/src/assets.rs b/src/assets.rs
index e299d02b91..220f9fc268 100644
--- a/src/assets.rs
+++ b/src/assets.rs
@@ -9,12 +9,12 @@ use syntect::parsing::{SyntaxReference, SyntaxSet};
use path_abs::PathAbs;
-use crate::bat_warning;
use crate::error::*;
use crate::input::{InputReader, OpenedInput};
-use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
+use crate::syntax_mapping::ignored_suffixes::IgnoredSuffixes;
+use crate::syntax_mapping::MappingTarget;
+use crate::{bat_warning, SyntaxMapping};
-use ignored_suffixes::*;
use minimal_assets::*;
use serialized_syntax_set::*;
@@ -24,7 +24,6 @@ pub use crate::assets::build_assets::*;
pub(crate) mod assets_metadata;
#[cfg(feature = "build-assets")]
mod build_assets;
-mod ignored_suffixes;
mod minimal_assets;
mod serialized_syntax_set;
@@ -195,7 +194,10 @@ impl HighlightingAssets {
let file_name = path.file_name().unwrap_or_default();
- match (self.get_syntax_for_file_name(file_name)?, syntax_match) {
+ match (
+ self.get_syntax_for_file_name(file_name, &mapping.ignored_suffixes)?,
+ syntax_match,
+ ) {
(Some(syntax), _) => Ok(syntax),
(_, Some(MappingTarget::MapExtensionToUnknown)) => {
@@ -203,7 +205,7 @@ impl HighlightingAssets {
}
_ => self
- .get_syntax_for_file_extension(file_name)?
+ .get_syntax_for_file_extension(file_name, &mapping.ignored_suffixes)?
.ok_or_else(|| Error::UndetectedSyntax(path.to_string_lossy().into())),
}
}
@@ -277,12 +279,18 @@ impl HighlightingAssets {
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
}
- fn get_syntax_for_file_name(&self, file_name: &OsStr) -> Result