Replies: 1 comment 2 replies
-
We've had similar requests in the past, but I think there's a sort of impedance mismatch here. null-ls is meant to mimic how LSP servers behave, and LSP servers generally don't provide this level of granularity - for example, if you send a formatting request, the server will respond with a list of changes based on how the server was configured in the first place, so that's what we do too. I'm open to solutions here, but given the mismatch between our architecture and this sort of functionality, I'm not sure it'd be worth it, especially given the existence of other projects better suited to this sort of workflow like Neoformat and nvim-lint (as well as simpler one-off solutions like |
Beta Was this translation helpful? Give feedback.
-
The use case I want is to run some LSP actions (
vim.lsp.buf.
{format,code_action,hover,etc.}) with specific null-ls sources. For example, if you have multiple formatter available for python, sayblack
,yapf
, andisort
, then you may want to runisort
only -- not touching anything with black or yapf.vim.lsp.buf.format({ filter = ... })
allows which LSP client to use only for this one-shot formatting, but in our case all three formatters have a facade LSP client, null-ls.One possible way might be to: temporarily disable all other sources,
null_ls.sources.disable(query)
then format thennull_ls.source.enable(query)
(recover the previous state). But this seems quite complicated and verbose.Is there any better way to try applying one specific null-ls sources when doing LSP actions, say as some additional context argument to
vim.lsp.buf.XXX
or custom APIs that can make LSP requests?Beta Was this translation helpful? Give feedback.
All reactions