local lsp_utils = require("plugins.lsp.lsp-utils") local fmt = require("null-ls").builtins.formatting local dgn = require("null-ls").builtins.diagnostics 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.gofmt, fmt.shfmt, -- # DIAGNOSTICS # dgn.eslint_d, dgn.shellcheck, dgn.luacheck.with({ extra_args = { "--globals", "vim", "--std", "luajit" }, }), require("null-ls").builtins.code_actions.gitsigns, }, }) -- NOTE: don't move this setup() call elsewhere require("lspconfig")["null-ls"].setup({ on_attach = function(client, bufnr) lsp_utils.fmt_on_save(client) lsp_utils.mappings(bufnr) end, })