astronvim/plugins/mason-null-ls.lua

37 lines
1.5 KiB
Lua
Raw Normal View History

2023-01-14 13:02:17 +01:00
return { -- overrides `require("mason-null-ls").setup(...)`
2023-01-20 10:54:22 +01:00
"jay-babu/mason-null-ls.nvim",
2023-02-04 17:25:37 +01:00
config = function(_, opts)
local mason_null_ls = require("mason-null-ls")
2023-02-03 16:08:09 +01:00
local null_ls = require "null-ls"
2023-02-04 17:25:37 +01:00
mason_null_ls.setup(opts)
mason_null_ls.setup_handlers { -- setup custom handlers
2023-02-03 16:08:09 +01:00
prettier = function()
require("null-ls").register(null_ls.builtins.formatting.prettier.with {
condition = function(utils)
return utils.root_has_file "package.json"
2023-02-04 17:25:37 +01:00
or utils.root_has_file ".prettierrc"
or utils.root_has_file ".prettierrc.json"
or utils.root_has_file ".prettierrc.js"
2023-02-03 16:08:09 +01:00
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,
2023-01-14 13:02:17 +01:00
}