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

Formatting "*.something" after "set filetype=yaml" #769

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

You must be logged in to vote

This isn't a null-ls issue–if you run Prettier with the same arguments from the command line, you'll see that it errors out because it can't infer a parser given the filename (the fact that this error is suppressed is a null-ls issue). You can manually specify the parser:

    local null_ls = require("null-ls")
    local sources = {
        null_ls.builtins.formatting.prettier.with({
            extra_args = function(params)
                return { "--parser", params.ft }
            end,
        }),
    }
    null_ls.setup({ sources = sources, debug = true })

Replies: 1 comment 2 replies

Comment options

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

@jose-elias-alvarez
Comment options

Answer selected by rnprest
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