load lspconfig after cmp | fix (#740)

if cmp isnt lazy loaded then load lspconfig after it so cmp-nvim-lsp capabilities can be used by lspconfig
This commit is contained in:
siduck 2022-01-23 12:54:15 +05:30
parent ddd13df5af
commit 4511b84d6c
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,13 @@
local plugin_settings = require("core.utils").load_config().plugins
local present, packer = pcall(require, plugin_settings.options.packer.init_file)
-- if cmp isnt lazy loaded -> load lspconfig after it
local loadAfter_cmp = false
if not plugin_settings.options.cmp.lazy_load then
loadAfter_cmp = "cmp-nvim-lsp"
end
if not present then
return false
end
@ -89,6 +96,7 @@ return packer.startup(function()
"neovim/nvim-lspconfig",
module = "lspconfig",
opt = true,
after = loadAfter_cmp,
setup = function()
require("core.utils").packer_lazy_load "nvim-lspconfig"
-- reload the current file so lsp actually starts for it