summaryrefslogtreecommitdiff
path: root/lua/config
diff options
context:
space:
mode:
Diffstat (limited to 'lua/config')
-rw-r--r--lua/config/lsp/init.lua1
-rw-r--r--lua/config/lsp/null-ls.lua39
2 files changed, 40 insertions, 0 deletions
diff --git a/lua/config/lsp/init.lua b/lua/config/lsp/init.lua
index b231014..7977351 100644
--- a/lua/config/lsp/init.lua
+++ b/lua/config/lsp/init.lua
@@ -7,3 +7,4 @@ end
require("config.lsp.lsp-installer")
require("config.lsp.handlers").setup()
+require("config.lsp.null-ls")
diff --git a/lua/config/lsp/null-ls.lua b/lua/config/lsp/null-ls.lua
new file mode 100644
index 0000000..74f8a03
--- /dev/null
+++ b/lua/config/lsp/null-ls.lua
@@ -0,0 +1,39 @@
+-- Adds LSP diagnostics and formatting.
+
+local null_ls_status_ok, null_ls = pcall(require, "null-ls")
+if not null_ls_status_ok then
+ return
+end
+
+-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
+local formatting = null_ls.builtins.formatting
+
+-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
+local diagnostics = null_ls.builtins.diagnostics
+
+null_ls.setup({
+ debug = false,
+ sources = {
+ diagnostics.cppcheck,
+ diagnostics.cspell,
+ diagnostics.flake8,
+ diagnostics.golangci_lint,
+ diagnostics.jsonlint,
+ diagnostics.luacheck,
+ diagnostics.shellcheck,
+ diagnostics.yamllint,
+ formatting.black.with({ extra_args = { "--fast" } }),
+ formatting.clang_format,
+ formatting.erlfmt,
+ formatting.fourmolu,
+ formatting.gofmt,
+ formatting.goimports,
+ formatting.nixfmt,
+ formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
+ formatting.rustfmt,
+ formatting.shfmt,
+ formatting.sqlformat,
+ formatting.stylua,
+ formatting.terraform_fmt,
+ },
+})