From 582489e557fa5398828151645ca10bdc4e4fae41 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 12 Jan 2022 22:54:26 +0100 Subject: Add null-ls --- lua/config/lsp/init.lua | 1 + lua/config/lsp/null-ls.lua | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lua/config/lsp/null-ls.lua (limited to 'lua/config/lsp') 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, + }, +}) -- cgit v1.2.3-70-g09d2