hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.44k stars 370 forks source link

cmp.core:prepare() is expansive and calls for every InsertEnter #1908

Open xzbdmw opened 2 months ago

xzbdmw commented 2 months ago

https://github.com/hrsh7th/nvim-cmp/blob/8f3c541407e691af6163e2447f3af1bd6e17f9a3/lua/cmp/init.lua#L333 It calls cmp.core:prepare() for every InsertEnter and it takes 20ms to run that prepare function, which makes o become laggy. And it is not async as its name suggests, because if you put a heavy loop in on_insert_enter and type o editor will freeze.

tomtomjhj commented 1 month ago

see also: https://github.com/hrsh7th/nvim-cmp/pull/1935