Skip to content
New issue

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

performance.throttle not delaying appearence of completion menu #2125

Open
2 tasks done
paride opened this issue Jan 13, 2025 · 2 comments
Open
2 tasks done

performance.throttle not delaying appearence of completion menu #2125

paride opened this issue Jan 13, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@paride
Copy link

paride commented Jan 13, 2025

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

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

  1. Configure neovim (latest 0.11 nightly) with the provided config
  2. echo foobar >> test.txt
  3. Open test.txt with nvim, add a new line and start typing foo
  4. Observe how the foobar completion 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.

@paride paride added the bug Something isn't working label Jan 13, 2025
@paride
Copy link
Author

paride commented Jan 13, 2025

I also tried with performance.debounce, but that doesn't seem to really help.

@xzbdmw
Copy link

xzbdmw commented Jan 20, 2025

setting debounce=1000 should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants