You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openjck
changed the title
ALE tells ShellCheck that files with the "bash" extension are POSIX sh files when vim-polyglot is installed
ALE tells ShellCheck to treat files with the ".bash" extension as sh files when vim-polyglot is enabled
Nov 19, 2021
Check for shebang #! line at the start of the script.
Check vim's local buffer variables (e.g. b:is_bash, b:is_sh, and b:is_kornshell). Set by vim ftdetect.
Check vim's global variables (e.g. g:is_bash, g:is_sh, and g:is_kornshell). Set by users to override vim ftdetect.
Check the filetype.
In your example 1 and 2 do not apply. For 3 I could test that b:is_bash is properly set when vim-polyglot is not installed but not defined if vim-polyglot is installed. Somehow vim-polyglot is messing with vim's default auto-detect logic and undefining these buffer variables.
You can test this by running ":echo b:is_bash" with the vim-polyglot plugin installed and when not installed.
Simple solution is to add a shellcheck directive to the script so ALE properly detects it as bash. Also would be good idea to report an issue in vim-polyglot to investigate the problem on their side.
Information
VIM version
Operating System: Ubuntu 21.04
What went wrong
When ALE and vim-polyglot are both enabled, ALE tells ShellCheck that files ending with a .bash extension are of type sh.
Reproducing the bug
Steps to reproduce
mv ~/.vim ~/.vim.bak.ale-issue-3988.$(date '+%s')
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/plugins/start/ale
git clone --depth 1 https://github.com/sheerun/vim-polyglot ~/.vim/pack/plugins/start/vim-polyglot
vim example.bash
Actual results
:ALEInfo
reports that option-s sh
is passed to ShellCheck. ShellCheck reports the following error, which only applies to POSIX sh:Expected results
:ALEInfo
reports that option-s bash
is passed to ShellCheck and ShellCheck reports no errors.:ALEInfo
Other notes
This works as expected if vim-polyglot is not enabled when Vim starts up, e.g., if the steps above are repeated and step 4 is skipped.
The text was updated successfully, but these errors were encountered: