Skip to content

performance.throttle not delaying appearence of completion menu #2125

Open
@paride

Description

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.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions