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

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

Open
4 tasks done
druskus20 opened this issue Sep 29, 2024 · 10 comments
Open
4 tasks done
Labels
bug Something isn't working

Comments

@druskus20
Copy link

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of noice.nvim
  • 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.

2024-09-29.18-09-24.mp4
  {
    "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 druskus20 added the bug Something isn't working label Sep 29, 2024
@joshuarubin
Copy link

+1

1 similar comment
@andreyfesunov
Copy link

+1

@Maverun
Copy link

Maverun commented Nov 2, 2024

+1 to this as well

@Skyppex
Copy link

Skyppex commented Nov 12, 2024

Also experiencing this on windows

@Welkin-Y
Copy link

Welkin-Y commented Dec 1, 2024

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

Copy link
Contributor

github-actions bot commented Jan 1, 2025

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 github-actions bot added the stale label Jan 1, 2025
@druskus20
Copy link
Author

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

image

@github-actions github-actions bot removed the stale label Jan 2, 2025
@Welkin-Y
Copy link

Welkin-Y commented Jan 6, 2025

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",
      },
    },
  }
}

@druskus20
Copy link
Author

druskus20 commented Jan 6, 2025

@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.

@Welkin-Y
Copy link

Welkin-Y commented Jan 6, 2025

@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

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

6 participants