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

[Bug] E5555: API call: Invalid window id

Open luiz00martins opened this issue 3 years ago • 2 comments

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
  • The lambda number and window ID varies, the line and error code doesn't.
  • The error only appears on the Dashboard, or an empty buffer ([No Name] buffer). If I open a file, and try it there, I get no error.

image

luiz00martins avatar Jun 08 '22 05:06 luiz00martins

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!

gelguy avatar Jun 19 '22 01:06 gelguy

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.

luiz00martins avatar Jul 03 '22 03:07 luiz00martins