cmp-vimtex icon indicating copy to clipboard operation
cmp-vimtex copied to clipboard

duplicated vimtex source problem

Open Jaehaks opened this issue 1 year ago • 3 comments

Thank you for your efforts,

If I configure cmp-vimex, CmpStatus shows me the vimtex sources are duplicated In nvim-cmp lazy.nvim setup, I called the cmp-vimtex plugin as dependencies.

Case 1) If I don't configure cmp-vimtex

dependencies = {
  'hrsh7th/cmp-buffer',       -- source for text in buffer
  'hrsh7th/cmp-path',         -- source for file system path
  'hrsh7th/cmp-cmdline',		-- source for commandline, [command], [path]
  'hrsh7th/cmp-nvim-lsp',     -- using LSP for source
  'f3fora/cmp-spell',			-- source for vim's spellsuggest
  'L3MON4D3/LuaSnip',         -- snippet engine
  'saadparwaiz1/cmp_luasnip', -- using LuaSnip for source
  'mstanciu552/cmp-matlab',   -- source of matlab
  {
    'micangl/cmp-vimtex', 		-- source of vimtex for latex
  },
},

Cmp-vimtex loaded just once for unused source names (I didn't load this source to confirm how many this source is called just.) image

Case 2) If I configure cmp-vimtex

dependencies = {
  'hrsh7th/cmp-buffer',       -- source for text in buffer
  'hrsh7th/cmp-path',         -- source for file system path
  'hrsh7th/cmp-cmdline',		-- source for commandline, [command], [path]
  'hrsh7th/cmp-nvim-lsp',     -- using LSP for source
  'f3fora/cmp-spell',			-- source for vim's spellsuggest
  'L3MON4D3/LuaSnip',         -- snippet engine
  'saadparwaiz1/cmp_luasnip', -- using LuaSnip for source
  'mstanciu552/cmp-matlab',   -- source of matlab
  {
    'micangl/cmp-vimtex', 		-- source of vimtex for latex
    config = function ()
      require('cmp_vimtex').setup({})
    end
  },
},

Cmp-vimtex loaded twice as below image

Could you know where the vimtex source are called one more?

Jaehaks avatar May 06 '24 13:05 Jaehaks

Thanks for raising the issue! May I ask @benbrastmckie if he is seeing the same output (vimtex listed twice in CmpStatus), as I see that he has a similar configuration?

It shouldn't, in any case, interfere with anything.

micangl avatar May 10 '24 17:05 micangl

@micangl Sure, Of course. I checked the config repository of @benbrastmckie. He configured the cmp-vimtex like this,

  1. configure cmp-vimtex in a file vimtex-cmp.lua separately and use lazy=false loading
  2. use cmp-vimtex as dependencies of nvim-cmp without any configuration

I applied above configuraiton before and It worked fine because it only loads once and configuration can be applied. But The downside is that it makes nvim loading time longer than before because cmp-vimtex is loaded at startup always with long load time (~200ms)

I want to lazy-load cmp-vimtex when nvim-cmp is loaded. But If he set lazy true in vimtex-cmp.lua, the vimtex will be called twice as the same with what I said

Jaehaks avatar May 10 '24 23:05 Jaehaks

@Jaehaks Unfortunately, there doesn't seem to be a way with lazy to call the setup function before the after/plugin/ files are sourced. This is what happens with the "normal" plugin loading process, and is necessary to keep the source compatible with non-lazy loaders.

At the moment I'm completely swamped so, since this is not a bug which prevents the plugin from working, I'll have to postpone finding a fix, as there doesn't seem to be an immediate one.

micangl avatar May 14 '24 09:05 micangl

As I said in the last comment, there doesn't seem to be a fix for this. Unfortunately, the loading processes of the various plugin managers are too different for me to provide a solution. I hope it won't be too annoying, sorry.

micangl avatar Aug 06 '24 10:08 micangl