42 lines
1.0 KiB
Lua
42 lines
1.0 KiB
Lua
local fmt = require("null-ls").builtins.formatting
|
|
local dgn = require("null-ls").builtins.diagnostics
|
|
local cda = require("null-ls").builtins.code_actions
|
|
|
|
require("null-ls").config({
|
|
sources = {
|
|
-- # FORMATTING #
|
|
fmt.trim_whitespace.with({
|
|
filetypes = { "text", "sh", "zsh", "yaml", "toml", "make", "conf" },
|
|
}),
|
|
-- NOTE:
|
|
-- 1. both needs to be enabled to so prettier can apply eslint fixes
|
|
-- 2. and prettierd should come first
|
|
fmt.prettierd,
|
|
fmt.eslint_d,
|
|
fmt.rustywind,
|
|
fmt.stylua,
|
|
fmt.goimports,
|
|
fmt.gofumpt,
|
|
fmt.shfmt,
|
|
-- # DIAGNOSTICS #
|
|
dgn.eslint_d,
|
|
dgn.shellcheck,
|
|
dgn.golangci_lint,
|
|
dgn.luacheck.with({
|
|
extra_args = { "--globals", "vim", "--std", "luajit" },
|
|
}),
|
|
-- # CODE ACTIONS #
|
|
cda.gitsigns,
|
|
cda.eslint_d,
|
|
cda.shellcheck,
|
|
},
|
|
})
|
|
|
|
-- NOTE: don't move this setup() call elsewhere
|
|
require("lspconfig")["null-ls"].setup({
|
|
on_attach = function(client, bufnr)
|
|
require("plugins.lsp.lsp-utils").fmt_on_save(client)
|
|
require("plugins.lsp.lsp-utils").mappings(bufnr)
|
|
end,
|
|
})
|