fix: correct order for cmp's setup (#1999)

This commit is contained in:
kylo252 2021-11-28 16:52:56 +01:00 committed by GitHub
parent 24be0ef1ef
commit 5c0ccff78f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 20 deletions

View file

@ -2,6 +2,7 @@ local M = {}
local uv = vim.loop local uv = vim.loop
local path_sep = uv.os_uname().version:match "Windows" and "\\" or "/" local path_sep = uv.os_uname().version:match "Windows" and "\\" or "/"
local in_headless = #vim.api.nvim_list_uis() == 0
---Join path segments that were passed as input ---Join path segments that were passed as input
---@return string ---@return string
@ -77,7 +78,7 @@ function M:init(base_dir)
vim.fn.mkdir(get_cache_dir(), "p") vim.fn.mkdir(get_cache_dir(), "p")
-- FIXME: currently unreliable in unit-tests -- FIXME: currently unreliable in unit-tests
if not os.getenv "LVIM_TEST_ENV" then if not in_headless then
_G.PLENARY_DEBUG = false _G.PLENARY_DEBUG = false
require("lvim.impatient").setup { require("lvim.impatient").setup {
path = join_paths(self.cache_dir, "lvim_cache"), path = join_paths(self.cache_dir, "lvim_cache"),

View file

@ -301,8 +301,7 @@ M.config = function()
} }
end end
M.setup = function() function M.setup()
require("luasnip/loaders/from_vscode").lazy_load()
require("cmp").setup(lvim.builtin.cmp) require("cmp").setup(lvim.builtin.cmp)
end end

View file

@ -15,7 +15,7 @@ local commit = {
nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81", nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81",
null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959", null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959",
nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07",
nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2", nvim_cmp = "092fb66b6ddb4b12b9b542d105d7af40e4fbd9f2",
nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1",
nvim_lsp_installer = "52183c68baf9019c8241b1abf33ba0b6594ab3c8", nvim_lsp_installer = "52183c68baf9019c8241b1abf33ba0b6594ab3c8",
nvim_lspconfig = "b53f89c16bcc8052aa56d3a903fcad3aaa774041", nvim_lspconfig = "b53f89c16bcc8052aa56d3a903fcad3aaa774041",
@ -78,44 +78,50 @@ return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
commit = commit.nvim_cmp, commit = commit.nvim_cmp,
config = function() config = function()
require("lvim.core.cmp").setup() if lvim.builtin.cmp then
end, require("lvim.core.cmp").setup()
run = function()
-- cmp's config requires cmp to be installed to run the first time
if not lvim.builtin.cmp then
require("lvim.core.cmp").config()
end end
end, end,
requires = {
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
},
module = "cmp",
}, },
{ {
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
commit = commit.friendly_snippets, commit = commit.friendly_snippets,
-- event = "InsertCharPre",
-- disable = not lvim.builtin.compe.active,
}, },
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
config = function()
require("luasnip/loaders/from_vscode").lazy_load()
end,
commit = commit.luasnip, commit = commit.luasnip,
}, },
{
"saadparwaiz1/cmp_luasnip",
commit = commit.cmp_luasnip,
},
{
"hrsh7th/cmp-buffer",
commit = commit.cmp_buffer,
},
{ {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
commit = commit.cmp_nvim_lsp, commit = commit.cmp_nvim_lsp,
}, },
{
"saadparwaiz1/cmp_luasnip",
commit = commit.cmp_luasnip,
after = "cmp",
},
{
"hrsh7th/cmp-buffer",
commit = commit.cmp_buffer,
after = "cmp",
},
{ {
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
commit = commit.cmp_path, commit = commit.cmp_path,
after = "cmp",
}, },
{ {
"hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lua",
commit = commit.cmp_nvim_lua, commit = commit.cmp_nvim_lua,
after = "cmp",
}, },
-- Autopairs -- Autopairs