-
Hello there! I run into trouble when trying to configure null-ls.nvim for a bit more complex workflow: switching between 3 different configs for linters - on demand, based on nvim variable changed with a key stroke. Can it be done? And if so, what would be the right way to configure it?
Here's a bit of background: I work with legacy projects and I find it very useful to quickly alter between different settings since only some of the projects that I deal with do follow proper coding standards (some of the files do not even have proper syntax, with ad hoc comments and such). For those projects, displaying dozens of linter errors only makes it very hard for me to focus on the task at hand - since most of the time I do not go there in order to take on the gargantuan job of fixing coding style in the legacy behemoth - but to apply a quick bugfix that would allow me to get it done quickly and just go back to my main work. Plugin documentation does not seem to cover such a case, so I looked around and tried different ways to solve it - none of which would work as I intended. Trying out random things I'd find in docs in hopes of achieving the desired result, there's a number of issues coming up:
Trying out the following commands did not help either:
Here's example of my neovim lua config code (simplified for clarity):
vimp is Vimpeccable plugin that adds a lua api to map keys directly to lua code and actually isn't necessary to debug here - commands can be issued in neovim like so |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'm not sure if there's more to your code than what you posted, but based on your description, this should be possible using the source API to enable / disable sources matching a given query. If you just want to show / hide diagnostics matching a given severity level, you may also be able to do this using the diagnostic API (see |
Beta Was this translation helpful? Give feedback.
-
Thank you very much @jose-elias-alvarez, your reply set me in the right direction and I worked out the way to achieve the desired outcome. Once you know what needs to be done, the code seems fairly simple! Although there was another little twist in there - the LSP language server here apparently already has some base language syntax check enabled on it's own (could be due to me using the LunarVim distribution) - so when I added another one with null-ls, I was pretty puzzled why I'd be seeing double messages! So here's the changed code that achieves precisely the effect that I described in my earlier posting:
|
Beta Was this translation helpful? Give feedback.
Thank you very much @jose-elias-alvarez, your reply set me in the right direction and I worked out the way to achieve the desired outcome. Once you know what needs to be done, the code seems fairly simple!
Although there was another little twist in there - the LSP language server here apparently already has some base language syntax check enabled on it's own (could be due to me using the LunarVim distribution) - so when I added another one with null-ls, I was pretty puzzled why I'd be seeing double messages!
So here's the changed code that achieves precisely the effect that I described in my earlier posting: