fix (#740) | lazy load lspconfig on nvim_cmp_lsp module

This commit is contained in:
siduck 2022-01-26 20:17:44 +05:30
parent 20e8249efa
commit ee5b79d3d4
4 changed files with 10 additions and 31 deletions

View File

@ -12,21 +12,6 @@ local function on_attach(_, bufnr)
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.preselectSupport = true
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
}
-- requires a file containing user's lspconfigs
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf

View File

@ -38,6 +38,7 @@ M.blankline = function(override_flag)
"TelescopePrompt",
"TelescopeResults",
"nvchad_cheatsheet",
'lsp-installer',
"",
},
buftype_exclude = { "terminal" },

View File

@ -169,7 +169,7 @@ default.git_branch = {
}
default.diagnostic = {
errors = {
error = {
provider = "diagnostic_errors",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)

View File

@ -1,13 +1,6 @@
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 = "nvim-cmp"
end
if not present then
return false
end
@ -96,7 +89,6 @@ 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
@ -134,6 +126,7 @@ return packer.startup(function()
use {
"rafamadriz/friendly-snippets",
module = 'cmp_nvim_lsp',
disable = not plugin_settings.status.cmp,
event = "InsertEnter",
}
@ -141,7 +134,7 @@ return packer.startup(function()
use {
"hrsh7th/nvim-cmp",
disable = not plugin_settings.status.cmp,
after = plugin_settings.options.cmp.lazy_load and "friendly-snippets",
after ="friendly-snippets",
config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
}
@ -149,7 +142,7 @@ return packer.startup(function()
"L3MON4D3/LuaSnip",
disable = not plugin_settings.status.cmp,
wants = "friendly-snippets",
after = plugin_settings.options.cmp.lazy_load and "nvim-cmp",
after = "nvim-cmp",
config = override_req("luasnip", "plugins.configs.others", "luasnip"),
}
@ -162,31 +155,31 @@ return packer.startup(function()
use {
"hrsh7th/cmp-nvim-lua",
disable = not plugin_settings.status.cmp,
after = plugin_settings.options.cmp.lazy_load and "cmp_luasnip",
after = "cmp_luasnip",
}
use {
"hrsh7th/cmp-nvim-lsp",
disable = not plugin_settings.status.cmp,
after = plugin_settings.options.cmp.lazy_load and "cmp-nvim-lua",
after = "cmp-nvim-lua",
}
use {
"hrsh7th/cmp-buffer",
disable = not plugin_settings.status.cmp,
after = plugin_settings.options.cmp.lazy_load and "cmp-nvim-lsp",
after = "cmp-nvim-lsp",
}
use {
"hrsh7th/cmp-path",
disable = not plugin_settings.status.cmp,
after = plugin_settings.options.cmp.lazy_load and "cmp-buffer",
after = "cmp-buffer",
}
-- misc plugins
use {
"windwp/nvim-autopairs",
disable = not plugin_settings.status.autopairs,
after = plugin_settings.options.cmp.lazy_load and plugin_settings.options.autopairs.loadAfter,
after = plugin_settings.options.autopairs.loadAfter,
config = override_req("nvim_autopairs", "plugins.configs.others", "autopairs"),
}