Use new method of setup for null-ls that doesn't use lspconfig

This commit is contained in:
ViViDboarder 2021-12-16 14:40:04 -08:00
parent 1c9990750b
commit 1eee1c727f

View File

@ -126,14 +126,18 @@ local function default_attach(client, bufnr)
end end
end end
function M.config_lsp() local function merged_capabilities()
local lsp_config = require("lspconfig")
-- Maybe update capabilities -- Maybe update capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
if utils.is_plugin_loaded("cmp-nvim-lsp") then utils.try_require("cmp-nvim-lsp", function(cmp_nvim_lsp)
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
end end)
return capabilities
end
function M.config_lsp()
local lsp_config = require("lspconfig")
local capabilities = merged_capabilities()
-- Configure each server -- Configure each server
lsp_config.bashls.setup({ capabilities = capabilities, on_attach = default_attach }) lsp_config.bashls.setup({ capabilities = capabilities, on_attach = default_attach })
@ -150,9 +154,6 @@ function M.config_lsp()
}, },
}, },
}) })
utils.try_require("null-ls", function()
lsp_config["null-ls"].setup({ capabilities = capabilities, on_attach = default_attach })
end)
end end
function M.config_lsp_saga() function M.config_lsp_saga()
@ -174,6 +175,8 @@ end
function M.config_null_ls() function M.config_null_ls()
utils.try_require("null-ls", function(null_ls) utils.try_require("null-ls", function(null_ls)
null_ls.setup({ null_ls.setup({
on_attach = default_attach,
capabilities = merged_capabilities(),
sources = { sources = {
-- Generic -- Generic
-- null_ls.builtins.formatting.preittier, -- null_ls.builtins.formatting.preittier,