filipdutescu / renamer.nvim

VS Code-like renaming UI for Neovim, writen in Lua.
Apache License 2.0
298 stars 11 forks source link

[Bug] Renamer doesn't work: Error executing lua ... attempt to index local p (a nil value) #120

Closed redxtech closed 2 years ago

redxtech commented 2 years ago

Describe the bug

Calling manually & from insert mode results in error, from normal mode it works, but no popup window. Only statusline.

Update: I have just confirmed that the statusline renaming is only due to the keybind being the same for my lsp rename function, and is in fact, not a part of this plugin at all. In any case, this is still broken, even more so than I had thought, but it at least helped figure out a few inconsistencies with this issue.

To reproduce

When I use the shortcut (<F2> in insert) to call lua require("renamer").rename(), or enter it manually, I get an error:

E5108: Error executing lua ...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:267: attempt to index local 'p' (a nil value)
stack traceback:                                                                                                                                                                                                  
        ...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:267: in function '_create_default_popup_opts'                                                                                                 
        ...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:135: in function 'rename'                                                                                                                     
        [string ":lua"]:1: in main chunk

And when I run it from normal mode, it works, but it doesn't use the popup. Instead, it uses the statusline.

Expected behavior:

I would expect it to use the popup window at all times, and also to work instead of giving an error message.

Environment

Screenshots

Error from manually calling: https://i.imgur.com/iyZ8NYn.png Working in statusline: https://i.imgur.com/VSOCdhI.png

redxtech commented 2 years ago

Ok so it turns out I had, at some point, deleted the call to require('renamer').setup {} from my code, and forgotten to put it back. I have put it back, and it works just as expected. Guess I should double-check plugins are set up before opening an issue, lol...