nvim/lua/plugins/null-ls.lua

35 lines
1.1 KiB
Lua
Raw Normal View History

2022-10-09 22:40:29 +02:00
local M = { module = "null-ls" }
function M.setup(options)
local nls = require("null-ls")
nls.setup({
debounce = 150,
save_after_format = false,
sources = {
-- nls.builtins.formatting.prettierd,
nls.builtins.formatting.stylua,
nls.builtins.formatting.fish_indent,
2022-10-10 22:15:54 +02:00
nls.builtins.formatting.fixjson.with({ filetypes = { "jsonc" } }),
2022-10-09 22:40:29 +02:00
-- nls.builtins.formatting.eslint_d,
-- nls.builtins.diagnostics.shellcheck,
2022-10-10 22:15:54 +02:00
nls.builtins.formatting.shfmt,
nls.builtins.diagnostics.markdownlint,
nls.builtins.formatting.deno_fmt.with({
filetypes = { "markdown" }, -- only runs `deno fmt` for markdown
}),
nls.builtins.diagnostics.selene,
2022-10-09 22:40:29 +02:00
-- nls.builtins.code_actions.gitsigns,
},
on_attach = options.on_attach,
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".nvim.settings.json", ".git"),
})
end
function M.has_formatter(ft)
local sources = require("null-ls.sources")
local available = sources.get_available(ft, "NULL_LS_FORMATTING")
return #available > 0
end
return M