From 8ddc41d8b42b13b27dddbae70fc5d859c881749a Mon Sep 17 00:00:00 2001 From: Ladar Levison Date: Tue, 14 Dec 2021 16:19:04 -0600 Subject: [PATCH] Handle files with first line shell opts. This should match: ``` #!/bin/bash ``` and ``` #!/bin/bash -eu ``` Currently the latter isn't being matched because the regex requires a new line after `sh` or `bash`. --- grammars/tree-sitter-bash.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/tree-sitter-bash.cson b/grammars/tree-sitter-bash.cson index 4f74335..a65b19e 100644 --- a/grammars/tree-sitter-bash.cson +++ b/grammars/tree-sitter-bash.cson @@ -12,7 +12,7 @@ injectionRegex: '^(bash|sh|BASH|SH)$' firstLineRegex: [ # shebang line - '^#!.*\\b(bash|sh)\\r?\\n' + '^#!.*\\b(bash|sh)(\\r?\\n|\\s)' # vim modeline 'vim\\b.*\\bset\\b.*\\b(filetype|ft|syntax)=(sh|bash)'