noice.nvim icon indicating copy to clipboard operation
noice.nvim copied to clipboard

bug: cmdline popupmenu completions (cmp backend) stop working after the first time

Open druskus20 opened this issue 1 year ago • 3 comments

Did you check docs and existing issues?

  • [X] I have read all the noice.nvim docs
  • [X] I have updated the plugin to the latest version before submitting this issue
  • [X] I have searched the existing issues of noice.nvim
  • [X] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.1

Operating system/version

Linux, Ubuntu

Describe the bug

Using the "cmp" backend for the popupmenu only works the first time, in subsequent attempts it simply does not show up.

https://github.com/user-attachments/assets/7f6828e9-0033-4585-9a83-240c3e5de21b

  {
    "folke/noice.nvim",
    opts = {
      cmdline = {
        view = "cmdline",
        enabled = true,
      },
      messages = {
        enabled = true,
      },
      
      popupmenu = {
        enabled = true,
        backend = "cmp"
      }
    },

I am also using LazyVim (somewhat heavily modified), but I was able to reproduce - see bellow

Steps To Reproduce

  1. Type a command and press TAB
  2. It should work
  3. Press ESC to exit (or choose a command)
  4. Repeat, type a command, this time TAB does nothing.

Expected Behavior

The completion menu opens again, just like it does with the nui backend

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "hrsh7th/nvim-cmp", opts = {} },
    { "folke/noice.nvim", opts = {

      cmdline = {
        view = "cmdline",
        enabled = true,
      },
      messages = {
        enabled = true,
      },

      popupmenu = {
        enabled = true,

        backend = "cmp" 
       
      }
    } 
  },
  },
})

druskus20 avatar Sep 29 '24 16:09 druskus20

+1

joshuarubin avatar Oct 22 '24 17:10 joshuarubin

+1

andreyfesunov avatar Oct 26 '24 20:10 andreyfesunov

+1 to this as well

Maverun avatar Nov 02 '24 03:11 Maverun

Also experiencing this on windows

Skyppex avatar Nov 12 '24 09:11 Skyppex

same For temporary solution, I modified keymap.listen function in ~/.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua as follows:

---Register keypress handler.
keymap.listen = function(mode, lhs, callback)
  if mode == 'c' and lhs == '<Tab>' then
    return
  end
  -- Original implementation continues
end

I hope that helps

Welkin-Y avatar Dec 01 '24 14:12 Welkin-Y

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jan 01 '25 02:01 github-actions[bot]

Still relevant - the behavior has changed slightly, but the "cmp" backend is still not working. I get:

image

druskus20 avatar Jan 01 '25 17:01 druskus20

Still relevant - the behavior has changed slightly, but the "cmp" backend is still not working. I get:

image

I guess your error is because of noice using blink.cmp instead of nvim.cmp as its new backend, and you are still using a config like backend=cmp. Instead, you can simply use this config to have a traditional cmdline view:

{
    "folke/noice.nvim",
    opts = {
      presets = {
        command_palette = false,
      },
      cmdline = {
        view = "cmdline",
      },
    },
  }
}

Welkin-Y avatar Jan 06 '25 07:01 Welkin-Y

@Welkin-Y Actually with a quick test, it looks to me like the issue is still there:

The following config works, that is not new:

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "hrsh7th/nvim-cmp", opts = {} },
    {
      "folke/noice.nvim",
      opts = {
        presets = {
          command_palette = false,
        },
        cmdline = {
          view = "cmdline",  
        },
      }
    },
  },
})

What I get

Expected behavior

The behavior I expect is a "default-style" completion popup next to the cursor:

image

Neither with cmp or blink (which currently appears not supported). So at least backend = "cmp" should be removed from the docs if support is not planned.

druskus20 avatar Jan 06 '25 10:01 druskus20

@druskus20 Thanks for sharing. I just tested with the latest noice and lazyvim version and it worked pretty well.
For the latest version, you can also omit { "hrsh7th/nvim-cmp", opts = {} },, since nvim-cmp has been replaced. image

Welkin-Y avatar Jan 06 '25 17:01 Welkin-Y

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 06 '25 02:02 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Feb 13 '25 02:02 github-actions[bot]