Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Custom formatter source #89

Answered by jose-elias-alvarez
AckslD asked this question in Q&A
Discussion options

You must be logged in to vote

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 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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@AckslD
Comment options

@jose-elias-alvarez
Comment options

Answer selected by jose-elias-alvarez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants