Closed Zeioth closed 2 months ago
Correct me if I'm wrong: seems https://github.com/nvimtools/none-ls.nvim/blob/f5632db2491fbe02b54f1a321a98548a8ba2bd15/lua/null-ls/sources.lua?plain=1#L101-L107 already handled this (generator._failed
)?
Ok I just discovered the next:
sources
.require("none-ls.formatting.mysource")
, require("none-ls.formatting.mysource")
, etc while regular builtins live in require("null-ls").builtins.formatting.mysource
This provokes mason-null-ls is not able to find external sources.
Fixing the issue in mason-null-ls.
Pros: Fixes the issue. Everything keep working the same.
Fixing the issue in none-ls (as in this PR).
Pros: It fixes the issue. Cons: It won't inform to users if the executable is not present anymore. It will just not load the source.
For now I'm gonna try to implement the solution in mason-null-ls
. but I'm keeping the PR open.
I've implemented a plugin to load internal and external sources intelligently when using mason: https://github.com/Zeioth/none-ls-autoload.nvim
But I would still consider merging this PR, so we don't register things we know for a fact are not going to work when trying to run them.
Because the tests are not passing, and we already have the plugin to solve this. Let's close the PR.
(for sources which command is different than nil).
Problem
A explicitly registered external source will be attached even if the source command is not actually executable. This create several unwanted scenarios:
This is inconsistent with the behavior of builtins, which will only attach if the executable is available. This inconsistent behavior is likely to be a regression.
Example
The next formatter appear attached even though we uninstalled it and rebooted neovim (bottom right of the image).![screenshot_2024-05-10_18-49-50_149890376](https://github.com/nvimtools/none-ls.nvim/assets/3357792/32fb34df-9c5e-4ea2-9c77-fbb793297b1c)
Trying to run the formatter will of cause an error.![screenshot_2024-05-10_18-51-58_029003400](https://github.com/nvimtools/none-ls.nvim/assets/3357792/e6841c11-daab-4585-85ed-b5283a4d51a0)
Solution