folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
4.38k stars 102 forks source link

bug: noselect is ignored resulting in a bug with coq #758

Closed ilan-schemoul closed 3 months ago

ilan-schemoul commented 6 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.9.5

Operating system/version

Windows 11 with WSL 2 Ubuntu

Describe the bug

First element of the menu is preselected when I enable popumenu with nui backend even though I set completeopt=menu,preview,noinsert,menuone,noselect. It's problematic because I use coq and I don't enable the preselect option. So when I see noice.nvim popupmenu I think the first element is selected so I press but it goes to a newline instead of applying popupmenu suggestion. Very confusing.

Despite the fact the first element is highlighted you have to press tab (first element is still highlighted) and then (enter)

I wish I could just disable popumenu but then in cmdline I don't have any popup (not even the native one ?) to see suggestions. It is instead at the bottom of the screen barely readable.

Steps To Reproduce

nvim -u init.lua a Run command :COQDeps Restart neovim nvim -u init.lua a type something in the buffer like TEST and then try starting type TES again then the TEST will appear. It will be highlighted. Press enter. Instead of the highlighted option it will insert a newline (very confusing).

Expected Behavior

Same behaviour as without noice (or noice when we disable popupmenu) : not highlighting the first element

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
vim.g.coq_settings = {
  auto_start = "shut-up",
}

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
vim.cmd("set completeopt=menu,menuone,noselect")

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    "folke/noice.nvim",
    -- add any other plugins here
    {
        "folke/noice.nvim",
        event = "VeryLazy",
        keys = {
            { "<leader><BS>", "<cmd>Noice dismiss<cr>" },
        },
        opts = {
            lsp = {
                progress = {
                    -- enabled = false,
                },
                hover = {
                    enabled = false,
                },
                signature = {
                    enabled = false,
                },
            },
            messages = {
                view = "mini",
                view_error = "notify",
                enabled = true,
            },
        },
        dependencies = {
            "MunifTanjim/nui.nvim",
            "rcarriga/nvim-notify",
        },
    },
    {
    "ms-jpq/coq_nvim",
    dependencies = {
      { "ms-jpq/coq.artifacts", branch = "artifacts" },
      { "ms-jpq/coq.thirdparty", branch = "3p" },
    },
    event = { "BufReadPre", "BufNewFile" },
    },
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
dapetcu21 commented 6 months ago

+1 on this one

ilan-schemoul commented 6 months ago

@folke do you have any idea about why the first element is always preselected. I tried to dig into the code and tried different things but didn't succeed there. If not possible to fix easily can I have popmenu only in cmdline popup ? If not possible can I have Neovim's native suggestion menu in the cmdline popup ? (because it's not great when suggestions are on the bottom of the screen and it's really annoying to have the pre-selection bug too)

github-actions[bot] commented 3 months ago

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.

ilan-schemoul commented 3 months ago

Why would it get closed ? Personally I've stopped using cmp. But @folke can say whether he doesn't want to support coq (then add a warning in the code if one loads coq) or whether it should be fixed