35 lines
1.1 KiB
Lua
35 lines
1.1 KiB
Lua
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,
|
|
nls.builtins.formatting.fixjson.with({ filetypes = { "jsonc" } }),
|
|
-- nls.builtins.formatting.eslint_d,
|
|
-- nls.builtins.diagnostics.shellcheck,
|
|
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,
|
|
-- 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
|