summaryrefslogtreecommitdiff
path: root/lua/config/lsp
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-12 22:54:26 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-12 22:54:26 +0100
commit582489e557fa5398828151645ca10bdc4e4fae41 (patch)
treea5d1ac798b20a9376f595a9c3925878963d1d129 /lua/config/lsp
parentc6d361d38bec220c4c1eef88f88aaf4ef95ab1d3 (diff)
Add null-ls
Diffstat (limited to 'lua/config/lsp')
-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,
+ },
+})