gelguy / wilder.nvim

A more adventurous wildmenu
MIT License
1.37k stars 34 forks source link

[Bug] E5555: API call: Invalid window id #140

Open luiz00martins opened 2 years ago

luiz00martins commented 2 years ago

With the following config

local wilder = require('wilder')
wilder.setup({
    modes = {':', '/', '?'},
})

wilder.set_option('renderer', wilder.popupmenu_renderer{
    highlighter = wilder.lua_pcre2_highlighter(),
    -- Also with this one:
    --highlighter = wilder.basic_highlighter(),
})

opening neovim, and typing :, /, or ? followed by something that has no autocompletion (e.g. :jaisujais, or /aaaaaaaaaa), results in the following error:

Error detected while processing function <lambda>1391
line 1:
E5555: API call: Invalid window id: 1003

image

gelguy commented 2 years ago

I've set up wilder and dashboard but am unable to reproduce this issue.

One possibility is there is a BufEnter/Leave autocommand in your config which is attempting to trigger for the wilder float window. The float is closed after CmdlineLeave which can cause issues for buffer autocommands.

Otherwise could you provide a minimal init.vim/lua to reproduce the issue (i.e. including the other plugins like telescope and dashboard)? Thanks!

luiz00martins commented 2 years ago

After some testing, I've pinpointed the problem to the renderer.

Here's a minimal example, which I hope you'll be able to reproduce:

local use = require('packer').use

use{"wbthomason/packer.nvim"}

use {
    'gelguy/wilder.nvim',
    config = function()
        local wilder = require('wilder')
        wilder.enable_cmdline_enter()
        wilder.setup({
            modes = {':', '/', '?'},
        })

        wilder.set_option('renderer', wilder.popupmenu_renderer{
            highlighter = wilder.lua_pcre2_highlighter(),
        })
    end
}

Note: Dashboard should not be necessary to reproduce, as the error also happens in the initial [No Name] buffer.


Edit: I have just switched to the experimental command-palette renderer, and I can confirm that the bug doesn't happen there.