nvim-cmp
nvim-cmp copied to clipboard
performance.throttle not delaying appearence of completion menu
FAQ
- [X] I have checked the FAQ and it didn't resolve my problem.
Announcement
- [X] I have checked Breaking change announcement.
Minimal reproducible full config
Neovim init.lua:
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
error('Error cloning lazy.nvim:\n' .. out)
end
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-buffer',
},
config = function()
local cmp = require 'cmp'
cmp.setup {
mapping = cmp.mapping.preset.insert(),
sources = {
{ name = 'buffer' },
},
performance = {
throttle = 2000,
},
}
end
},
})
Description
The throttle = 2000 setting is not honored: the completion menu appears almost immediately while typing.
Steps to reproduce
- Configure neovim (latest 0.11 nightly) with the provided config
echo foobar >> test.txt- Open
test.txtwith nvim, add a new line and start typingfoo - Observe how the
foobarcompletion appears almost immediately, and not after 2000ms.
Expected behavior
The completion menu only appears only after nothing is typed for 2000ms.
Actual behavior
The completion menu appears almost immediately while typing.
Additional context
This is not specific to cmp-buffer, but using cmp-buffer makes an easy reproducer because we don't need to configure any LSP or similar.
I also tried with performance.debounce, but that doesn't seem to really help.
setting debounce=1000 should work.