Custom formatter source #89
-
I'm trying to setup a custom formatter source with null_ls.helpers.formatter_factory({
command = 'autopep8',
}) but looking at the source files this doesn't seem to be exposed anymore. So instead I tried: null_ls.formatter({
command = 'autopep8',
}) which doesn't give any error. But I wasn't sure exactly how to now use this source. Should one just do: local null_ls = require('null-ls')
null_ls.config({
sources = {
null_ls.formatter({
command = 'autopep8',
}),
},
}) ? Doing the above does not seem to work for me. Is it supposed to? Also is there some way to see the currently active sources? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Try the following: local autopep8 = {
method = null_ls.methods.FORMATTING,
filetypes = { "python" },
generator = null_ls.formatter({
command = "autopep8",
args = { "-" },
to_stdin = true,
}),
}
null_ls.config({
sources = {
autopep8,
},
}) We'd be happy to have you contribute For your second question: Not at the moment, but I'd like to add something like nvim-lspconfig's |
Beta Was this translation helpful? Give feedback.
Try the following:
We'd be happy to have you contribute
autopep8
as a built-in formatter, too, if that's something you're interested in (at the moment, making built-ins is easier than setting up custom sources, to be honest).For your second question: Not at the moment, but I'd like to add something like nvim-lspconfig's
:LspInfo
to show currently available sources. I'll open up an issue to remind myself.