Merge pull request #2906 from elebow/shelldetect-fall-back-to-filetype-if-no-hashbang

ShellDetect falls back to filetype if no hashbang (fixes #2886)
This commit is contained in:
w0rp
2020-08-17 21:29:16 +01:00
committed by GitHub
3 changed files with 24 additions and 7 deletions

View File

@@ -98,6 +98,16 @@ Execute(The ksh dialect should be used for shellcheck if b:is_kornshell is 1):
AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
Execute(The filetype should be used as the default shell type when there is no hashbang line):
set filetype=zsh
AssertEqual 'zsh', ale#handlers#sh#GetShellType(bufnr(''))
set filetype=tcsh
AssertEqual 'tcsh', ale#handlers#sh#GetShellType(bufnr(''))
set filetype=python
AssertEqual '', ale#handlers#sh#GetShellType(bufnr(''))
Given(A file with /bin/ash):
#!/bin/ash