diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/config/lsp/init.lua | 1 | ||||
-rw-r--r-- | lua/config/lsp/null-ls.lua | 39 | ||||
-rw-r--r-- | lua/plugins.lua | 1 |
3 files changed, 41 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, + }, +}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 8789397..c2a9d29 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -25,6 +25,7 @@ return { { "williamboman/nvim-lsp-installer" }, -- simple to use language server installer -- Telescope -- + { "jose-elias-alvarez/null-ls.nvim" }, { "nvim-telescope/telescope.nvim" }, -- Treesitter -- |