astronvim/plugins/mason-null-ls.lua
2023-02-04 17:25:37 +01:00

37 lines
1.5 KiB
Lua

return { -- overrides `require("mason-null-ls").setup(...)`
"jay-babu/mason-null-ls.nvim",
config = function(_, opts)
local mason_null_ls = require("mason-null-ls")
local null_ls = require "null-ls"
mason_null_ls.setup(opts)
mason_null_ls.setup_handlers { -- setup custom handlers
prettier = function()
require("null-ls").register(null_ls.builtins.formatting.prettier.with {
condition = function(utils)
return utils.root_has_file "package.json"
or utils.root_has_file ".prettierrc"
or utils.root_has_file ".prettierrc.json"
or utils.root_has_file ".prettierrc.js"
end,
})
end,
-- For prettierd:
-- prettierd = function()
-- require("null-ls").register(require("null-ls").builtins.formatting.prettierd.with({
-- condition = function(utils)
-- return utils.root_has_file("package.json") or utils.root_has_file(".prettierrc") or utils.root_has_file(".prettierrc.json") or utils.root_has_file(".prettierrc.js")
-- end
-- }))
-- end,
-- For eslint_d:
-- eslint_d = function()
-- require("null-ls").register(require("null-ls").builtins.diagnostics.eslint_d.with({
-- condition = function(utils)
-- return utils.root_has_file("package.json") or utils.root_has_file(".eslintrc.json") or utils.root_has_file(".eslintrc.js")
-- end
-- }))
-- end,
}
end,
}