nvimtools / none-ls.nvim

null-ls.nvim reloaded / Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
The Unlicense
2.39k stars 69 forks source link

bash-language-server → No code actions #89

Closed Zeioth closed 5 months ago

Zeioth commented 5 months ago

FAQ

Issues

Neovim Version

v0.9.5

Dev Version?

Operating System

arch

Minimal Config

x

Steps to Reproduce

x

Reproducibility Check

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:

What doesn't work:

More info: Previously I had code actions working with:

require("null-ls").builtins.code_actions.shellcheck

Requirements

Zeioth commented 5 months ago

bashls and null-ls appear both loaded. screenshot_2024-03-06_15-21-41_530447070

And I can autoformat correctly.

Zeioth commented 5 months ago

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.

mochaaP commented 5 months ago

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.

mochaaP commented 5 months ago

I guess I would leave this open to track the progress on bash-language-server

Zeioth commented 5 months ago

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.

Zeioth commented 5 months ago

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. screenshot_2024-03-06_16-06-44_180080521

mochaaP commented 5 months ago

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?

This was intended and will not change.

Zeioth commented 5 months ago

As long as we add it to the wiki in the future it's cool.

mochaaP commented 5 months ago

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!

Zeioth commented 5 months ago

I can't take care of the wiki atm sorry. But I will be helping with QA from NormalNvim

Zeioth commented 5 months ago

Another report: Unless I'm wrong → beautysh is not loaded anymore event after installing "nvimtools/none-ls-extras.nvim".

mochaaP commented 5 months ago

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.

Zeioth commented 5 months ago

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.

mochaaP commented 5 months ago

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, https://github.com/nvimtools/none-ls.nvim/discussions/81#discussioncomment-8583064 & https://github.com/bash-lsp/bash-language-server/blob/afd0d82c5a0a3cbedef8098b8944d9b01c47657e/server/src/shellcheck/index.ts#L239

mochaaP commented 5 months ago

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.

Zeioth commented 5 months ago

I've re-tested and even without

local nls = require("null-ls")
local shellcheck_code_actions = require("none-ls-shellcheck.code_actions")

bashls do have code actions. screenshot_2024-03-08_03-13-54_649343778

The confusion came from the fact standalone shellcheck offer different code actions (often unnecesary ones, like "ignore rule").

screenshot_2024-03-08_03-16-17_031233213 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.