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

Declare multiple time the same formatter but with different settings #238

Discussion options

You must be logged in to vote

It's dirty, but it's possible to do this by copying the built-in, changing the name, and setting _opts directly (since with references the original object):

local null_ls = require("null-ls")

local prettier = null_ls.builtins.formatting.prettierd
prettier._opts.filetypes = { "json", "markdown", "yaml" }

local prettier_javascript = vim.deepcopy(prettier)
prettier_javascript.name = "prettier_javascript"
prettier_javascript._opts.filetypes = { "javascript" }
setmetatable(prettier_javascript, getmetatable(prettier))

local sources = {
    require("null-ls.helpers").conditional(function(utils)
        local usesEslint = vim.fn.glob(".eslintrc*") ~= ""
            or (
                utils.r…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Nargonath
Comment options

@Nargonath
Comment options

@jose-elias-alvarez
Comment options

@Nargonath
Comment options

Answer selected by jose-elias-alvarez
Comment options

You must be logged in to vote
0 replies
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