summaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorath32021-11-08 15:19:44 +0000
committerGitHub2021-11-08 15:19:44 +0000
commit77dbbc73f9c9b6599bc39b18625285685fe2e4b1 (patch)
treeaddc76d4c1ca00d108c689da3a114609bab38e1e /helix-view/src
parent29e684941389f949491efe4d9807a0edd1facee3 (diff)
Detect filetype from shebang line (#1001)
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/document.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index ce5df8ee..a68ab759 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -494,7 +494,9 @@ impl Document {
/// Detect the programming language based on the file type.
pub fn detect_language(&mut self, theme: Option<&Theme>, config_loader: &syntax::Loader) {
if let Some(path) = &self.path {
- let language_config = config_loader.language_config_for_file_name(path);
+ let language_config = config_loader
+ .language_config_for_file_name(path)
+ .or_else(|| config_loader.language_config_for_shebang(path));
self.set_language(theme, language_config);
}
}