aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/syntax.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index a08e5084..f9a2ea5f 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -471,9 +471,10 @@ impl Loader {
for file_type in &config.file_types {
// entry().or_insert(Vec::new).push(language_id);
+ let file_type = file_type.replace('/', &std::path::MAIN_SEPARATOR.to_string());
loader
.language_config_ids_by_file_type
- .insert(file_type.clone(), language_id);
+ .insert(file_type, language_id);
}
for shebang in &config.shebangs {
loader
@@ -498,6 +499,17 @@ impl Loader {
path.extension()
.and_then(|extension| extension.to_str())
.and_then(|extension| self.language_config_ids_by_file_type.get(extension))
+ })
+ .or_else(|| {
+ self.language_config_ids_by_file_type
+ .iter()
+ .find_map(|(file_type, id)| {
+ if path.to_str()?.ends_with(file_type) {
+ Some(id)
+ } else {
+ None
+ }
+ })
});
configuration_id.and_then(|&id| self.language_configs.get(id).cloned())