spacemacs
spacemacs copied to clipboard
sh-shellcheck which is flycheck's builtin checker for bash script is not working automatically if both shell-scripts and lsp layers are enabled
Description :octocat:
<<DESCRIPTION OF THE PROBLEM>>
When I enable shell-scripts
and do not enable lsp
layer, after I open a bash script file, the value flycheck-check
is nil, but the checker inside the buffer works fine, I think it is sh-shellcheck
which is defined in flycheck code
When I enable both shell-scripts
and lsp
layers at the same time, after I open a bash script file, the value flycheck-check
becomes lsp
, the lsp
is working fine such as the popup doc window, but lsp
doesn't do any checking about the bash script syntax.
Reproduction guide :beetle:
-
cp ~/.emacs.d/core/templates/.spacemacs.template ~/.spacemacs
- enable
shell-scripts
andlsp
in layer part of ~/.spacemacs - start emacs to install packages
- restart emacs and open a bash script
- no bash script checker is running,
flycheck-checker
islsp
Observed behaviour: :eyes: :broken_heart:
<<DESCRIPTION OF THE OBSERVED BEHAVIOUR>>
no bash script checker is running, flycheck-checker
is lsp
, but this flycheck-checker
does not check the buffer's syntax.
Manually M-x flycheck-select-checker RET sh-shellcheck
, then the shellcheck will work, but I need it to be automatically enabled.
Expected behaviour: :heart: :smile:
<<DESCRIPTION OF THE EXPECTED BEHAVIOUR>>
flyeck-checker
of sh-shellcheck
shoule be working even if its value is nil just like if I don't enable lsp layer
If I can choose, sh-shellcheck and lsp should both work, if only one works, I choose sh-shellcheck
.
System Info :computer:
- OS: gnu/linux
- Emacs: 28.0.50
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 7ef15a561)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
(emacs-lisp helm multiple-cursors syntax-checking lsp shell-scripts treemacs)
- System configuration features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB
Backtrace :paw_prints:
<<BACKTRACE IF RELEVANT>>
Confirmed.
We can add a line to choose sh-shellcheck
as flycheck checker.
But the right way to deal with this is to fix the problem in upstream.
We can add a line to choose
sh-shellcheck
as flycheck checker.
I may be mistaken, but I think we want to choose sh-bash
, which chains to sh-shellcheck
, because otherwise some syntax errors won’t get caught.
But the right way to deal with this is to fix the problem in upstream.
What should we ask upstream? To chain sh-shellcheck
after lsp
for Bash, the same way it’s done for sh-bash
? I’m not sure it’s even possible, because lsp
is not specific to Bash.
OP said:
but
lsp
doesn't do any checking about the bash script syntax.
So maybe upstream needs to chain lsp
→sh-bash
→sh-shellcheck
?
LSP is not language specific, but LSP client is.
The upstream is here https://github.com/bash-lsp/bash-language-server
We should just make a feature request.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!