We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minimal_init.lua
local root_dir = vim.fn.fnamemodify(vim.trim(vim.fn.system('git rev-parse --show-toplevel')), ':p') package.path = string.format('%s;%s?.lua;%s?/init.lua', package.path, root_dir, root_dir) vim.opt.packpath:prepend(root_dir .. '.testcache/site') vim.opt.runtimepath:prepend(root_dir) vim.cmd([[ packadd nvim-cmp ]]) local cmp = require('cmp') cmp.setup({ completion = { autocomplete = false, }, }) cmp.event:on('menu_opened', function() print('menu_opened', os.clock()) end) cmp.event:on('menu_closed', function() print('menu_closed', os.clock()) end)
test.sh
#!/usr/bin/env bash function setup_environment() { echo echo "[test] setting up environment" echo local plugins_dir="./.testcache/site/pack/deps/start" mkdir -p "${plugins_dir}" echo "[nvim-cmp] linking..." mkdir -p "./.testcache/site/pack/deps/opt" ln -nsf "$(pwd)" "./.testcache/site/pack/deps/opt/nvim-cmp" echo "[test] environment ready" echo } setup_environment nvim --clean --noplugin -u minimal_init.lua
After adding a few logs inside the source code, found out that:
nvim-cmp/lua/cmp/view.lua
Lines 119 to 121 in 17a55b3
Lines 134 to 136 in 17a55b3
Those two code paths are running very often. And because of that menu_closed is emitted even if the menu is not visible.
menu_closed
Run ./test.sh
./test.sh
Start typing something or move around in insert mode.
Even if the completion menu is not opened once, the menu_closed will be printed very often.
menu_closed will only fire when menu was actually opened and then closed.
menu_closed is fired very often even when menu was never opened.
No response
The text was updated successfully, but these errors were encountered:
The menu_opened event is also emitted too often. What do you use this event and the actual problem is?
menu_opened
Sorry, something went wrong.
What do you use this event?
https://github.com/zbirenbaum/copilot.lua/blob/2202f7abe238e9e4e28fb91a885fc1e8a2fd2ab5/README.md?plain=1#L106-L118
and the actual problem is?
Since I'm using it only to set a variable, I guess it doesn't matter much for my use-case.
But created the issue 'cause I expected these events to be emitted when the menu is actually opened/closed.
To be honest, I also think the current implementation is not good and not reasonable. But changing the implementation would be a breaking change...
What is the status of this?
Even when autocompletion is disabled it runs this event on every keystroke.
cmp.setup({ completion = { autocomplete = false } }
The menu_opened event is also emitted too often.
For me and this snippet menu_opened doesn't invoke on every key pressed, like menu_closed.
nvim-cmp
No branches or pull requests
FAQ
Announcement
Minimal reproducible full config
minimal_init.lua
test.sh
Description
After adding a few logs inside the source code, found out that:
nvim-cmp/lua/cmp/view.lua
Lines 119 to 121 in 17a55b3
nvim-cmp/lua/cmp/view.lua
Lines 134 to 136 in 17a55b3
Those two code paths are running very often. And because of that
menu_closed
is emitted even if the menu is not visible.Steps to reproduce
Run
./test.sh
Start typing something or move around in insert mode.
Even if the completion menu is not opened once, the
menu_closed
will be printed very often.Expected behavior
menu_closed
will only fire when menu was actually opened and then closed.Actual behavior
menu_closed
is fired very often even when menu was never opened.Additional context
No response
The text was updated successfully, but these errors were encountered: