bash-language-server → No code actions
Zeioth opened this issue · comments
FAQ
- I have checked the FAQ and it didn't resolve my problem.
Issues
- I have checked existing issues and there are no issues with the same problem.
Neovim Version
v0.9.5
Dev Version?
- I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.
Operating System
arch
Minimal Config
x
Steps to Reproduce
x
Reproducibility Check
- I confirm that my minimal config is based on the
minimal_init.lua
template and that my issue is reproducible by runningnvim --clean -u minimal_init.lua
and following the steps above.
Expected Behavior
x
Actual Behavior
x
Debug Log
x
Help
No
Implementation Help
As indicated here I've installed shellcheck
on mason, as replacement for the built-in the bash-language-server
.
What works:
- Linting → Works ok: It requires you to install shellcheck.
- LSP → Works ok: it requires you to install bash-language-server.
- Formatting → Works ok: it requires you to install shfmt.
What doesn't work:
- Code actions are not available anymore.
More info:
Previously I had code actions working with:
require("null-ls").builtins.code_actions.shellcheck
Requirements
- I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.
Ok I've tested in a old version of none-ls and it seems this is a requirement for the code actions feature to be available:
require("null-ls").builtins.code_actions.shellcheck
Because the built-in has been removed it seems there is no way to do this anymore.
If you are not against bash-language-server, you could make a PR to there. I mentioned the exact line of code somewhere in #81.
You could use gbprod/none-ls-shellcheck.nvim in the meantime.
I guess I would leave this open to track the progress on bash-language-server
Issue solved by adding this to none-ls config:
require("null-ls").register(require("none-ls-shellcheck.code_actions"))
but it requires the none-ls dependency "gbprod/none-ls-shellcheck.nvim".
It was documented. Sorry.
Maybe "gbprod/none-ls-shellcheck.nvim"
should be shipped by default with none-ls and do require("null-ls").register(require("none-ls-shellcheck.code_actions"))
if shellcheck is loaded?
Unless the fact linting still requires shellcheck
to be installed is a bug. I have shellcheck installed. It doesn't appear listed on :LSPInfo but it works. If I uninstall shellcheck, linting stops working.
Maybe
"gbprod/none-ls-shellcheck.nvim"
should be shipped by default with none-ls and dorequire("null-ls").register(require("none-ls-shellcheck.code_actions"))
if shellcheck is loaded?
This was intended and will not change.
As long as we add it to the wiki in the future it's cool.
As long as we add it to the wiki in the future it's cool.
The wiki is open for everyone to edit. It's appreciated if you could do it!
I can't take care of the wiki atm sorry. But I will be helping with QA from NormalNvim
Another report: Unless I'm wrong → beautysh is not loaded anymore event after installing "nvimtools/none-ls-extras.nvim".
Another report: Unless I'm wrong → beautysh is not loaded anymore event after installing "nvimtools/none-ls-extras.nvim".
Intended, see #81 still.
beautysh is only useful for zsh (because it does not fail on parsing), but it formats the code wrongly so you might encounter some unknown issues with it.
Re-opened, as this one seems to actually be a bug.
It is currently necessary to do
"gbprod/none-ls-shellcheck.nvim"
local nls = require("null-ls")
local shellcheck_code_actions = require("none-ls-shellcheck.code_actions")
nls.register(shellcheck_code_actions) -- shell code actions.
in order to enable shell code actions. This shouldn't be necessary. According to this bashls should include code actions already, which is not the case.
If you are not against bash-language-server, you could make a PR to there. I mentioned the exact line of code somewhere in #81.
found it, #81 (comment) & https://github.com/bash-lsp/bash-language-server/blob/afd0d82c5a0a3cbedef8098b8944d9b01c47657e/server/src/shellcheck/index.ts#L239
cc @skovhus you might want to take a look at this. :)
tl;dr: users are missing disable SC#### for this line / this file
code actions in bash-lsp.
I've re-tested and even without
local nls = require("null-ls")
local shellcheck_code_actions = require("none-ls-shellcheck.code_actions")
The confusion came from the fact standalone shellcheck offer different code actions (often unnecesary ones, like "ignore rule").
So there are now less scenarios where code actions are usable but the code actions offered to us are actually useful.
So this can be closed, sorry for the noise.