Skip to content

Commit

Permalink
Support env flags in shebang (helix-editor#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
ath3 authored Dec 3, 2021
1 parent 038a6ce commit 70c6253
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down

0 comments on commit 70c6253

Please sign in to comment.