diff options
author | ath3 | 2021-12-03 15:13:24 +0000 |
---|---|---|
committer | GitHub | 2021-12-03 15:13:24 +0000 |
commit | 70c62530ee0b6fba28816ca4454557baf1f2e440 (patch) | |
tree | 3c65fc9e5e2e8707c18046e52b4298b0f969aa5a /helix-core/src | |
parent | 038a6ce22cb9a4eeebb63abc7d07523bb72d3175 (diff) |
Support env flags in shebang (#1224)
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/syntax.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 142265a8..ba78adaa 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -310,8 +310,9 @@ impl Loader { pub fn language_config_for_shebang(&self, source: &Rope) -> Option<Arc<LanguageConfiguration>> { let line = Cow::from(source.line(0)); - static SHEBANG_REGEX: Lazy<Regex> = - Lazy::new(|| Regex::new(r"^#!\s*(?:\S*[/\\](?:env\s+)?)?([^\s\.\d]+)").unwrap()); + static SHEBANG_REGEX: Lazy<Regex> = Lazy::new(|| { + Regex::new(r"^#!\s*(?:\S*[/\\](?:env\s+(?:\-\S+\s+)*)?)?([^\s\.\d]+)").unwrap() + }); let configuration_id = SHEBANG_REGEX .captures(&line) .and_then(|cap| self.language_config_ids_by_shebang.get(&cap[1])); |