dstein64 / nvim-scrollview

A Neovim plugin that displays interactive vertical scrollbars and signs.
MIT License
563 stars 10 forks source link

Bug: E5108: Error executing lua [string ":lua"]:1: attempt to call field 'set_state' (a nil value) #110

Closed LeeWannacott closed 1 year ago

LeeWannacott commented 1 year ago

Just did PlugUpdate: image

This related to this in some way? https://github.com/dstein64/nvim-scrollview/commit/d14802687760315e14609e357f73eae771b40774

dstein64 commented 1 year ago

Thanks for reporting the issue @LeeWannacott.

What version of Neovim are you using? Do you know any steps I can use to reproduce the issue? For example, does this happen with only nvim-scrollview and no other plugins and no custom configuration, or is some custom configuration and/or other plugins required to replicate?

Does the error occur when you start Neovim, or does it require some action?

"This related to this in some way? d14802687760315e14609e357f73eae771b40774"

It's not clear to me what the relation would be, but it's possible. Was the issue triggered by pressing zf?

LeeWannacott commented 1 year ago

What version of Neovim are you using

v0.7.2

Does the error occur when you start Neovim, or does it require some action?

It only happened once when I ran :PlugUpdate which updates plugins, so not a big deal. Scrollview seems to be working fine (I just use the base feature of the scrollbar; so I don't know about the signs and stuff)

Even though it says its an error maybe its just a warning...

It's not clear to me what the relation would be, but it's possible. Was the issue triggered by pressing zf?

I don't think it was from hitting zf; so probably not related.

Maybe its just that Signs require nvim>=0.9 . The code in signs/trail possibly shouldn't be callable unless Nvim >=0.9 version is satisfied; I haven't looked through all the code, so this might be the case?

I could give you a config, but I'm guessing its just the above ^

dstein64 commented 1 year ago

Thanks for the additional details. I am now able to replicate the issue.

I reproduced the error by using vim-plug to install an older version (v3.0.0) of nvim-scrollview, and then used vim-plug to update to a newer version (v4.2.0).

vim-plug reloads a plugin after a plugin update (https://github.com/junegunn/vim-plug/issues/222).

Although nvim-scrollview was reloaded, the corresponding Lua module was not. This led to the set_state error, since that newly added function was not available yet in the Lua module (since the Lua module had not been reloaded).

I added a guard variable in 851f03c7e165d45ba2358fe6de68dc909695f5e2 to prevent nvim-scrollview from being reloaded. This prevents the error, but Neovim will have to be restarted after PlugUpdate to get any updates. https://github.com/junegunn/vim-plug/issues/461#issuecomment-204619857