Forráskód Böngészése

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

kylo252 3 éve
szülő
commit
5c0ccff78f
3 módosított fájl, 22 hozzáadás és 16 törlés
  1. 2 1
      lua/lvim/bootstrap.lua
  2. 1 2
      lua/lvim/core/cmp.lua
  3. 19 13
      lua/lvim/plugins.lua

+ 2 - 1
lua/lvim/bootstrap.lua

@@ -2,6 +2,7 @@ local M = {}
 
 local uv = vim.loop
 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
 ---@return string
@@ -77,7 +78,7 @@ function M:init(base_dir)
   vim.fn.mkdir(get_cache_dir(), "p")
 
   -- FIXME: currently unreliable in unit-tests
-  if not os.getenv "LVIM_TEST_ENV" then
+  if not in_headless then
     _G.PLENARY_DEBUG = false
     require("lvim.impatient").setup {
       path = join_paths(self.cache_dir, "lvim_cache"),

+ 1 - 2
lua/lvim/core/cmp.lua

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

+ 19 - 13
lua/lvim/plugins.lua

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