sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.74k stars 105 forks source link

DiffViewOpen error #350

Closed rsrehov closed 1 year ago

rsrehov commented 1 year ago

I installed diffview using packer as well as it's dependencies except for Mercural. I assume we don't need it if we use Git. I'm getting the following error when try to use DiffViewOpen command. Are there any thoughts as to what might be causing this error?

Error executing Lua callback: ...site/pack/packer/start/diffview.nvim/lua/diffview/hl.lua:129: attempt to call field 'nvim_get_hl' (a nil value) stack traceback: ...site/pack/packer/start/diffview.nvim/lua/diffview/hl.lua:129: in function 'get_hl' ...site/pack/packer/start/diffview.nvim/lua/diffview/hl.lua:166: in function 'get_hl_attr' ...site/pack/packer/start/diffview.nvim/lua/diffview/hl.lua:185: in function 'get_fg' ...site/pack/packer/start/diffview.nvim/lua/diffview/hl.lua:466: in function 'update_diff_hl' ...site/pack/packer/start/diffview.nvim/lua/diffview/hl.lua:475: in function 'setup' ...te/pack/packer/start/diffview.nvim/lua/diffview/init.lua:25: in function 'init' ...te/pack/packer/start/diffview.nvim/lua/diffview/init.lua:260: in main chunk [C]: in function 'handler' ...te/pack/packer/start/diffview.nvim/lua/diffview/lazy.lua:21: in function 'get' ...te/pack/packer/start/diffview.nvim/lua/diffview/lazy.lua:36: in function 'index' ...site/pack/packer/start/diffview.nvim/plugin/diffview.lua:24: in function <...site/pack/packer/start/diffview.nvim/plugin/diffview.lua:23>

gegoune commented 1 year ago

If you are on nightly version of neovim make sure you are using latest version. Or use latest released version instead.

sindrets commented 1 year ago

Closing as duplicate of #337.

rsrehov commented 1 year ago

If you are on nightly version of neovim make sure you are using latest version. Or use latest released version instead.

Ok. I'll do that. So after doing some research I think I understand what might have happened in my case. But I wanted to confirm with someone just to make sure. I regularly update my plugins but not my neovim install. Somewhere in some nightly release of neovim there was a change in a function(api) that neovim had and diffview was using that. The function was called nvimget_hl_defs. Recently neovim changed that function to nvim_get_hl. For those updating neovim after that change it broke diffview. So diffview decided to update their api calls to use the new nvim_get_hl function. Since I update my plugins often that broke my version since I was still using a version of neovim that was expecting nvimget_hl_defs. Does that about sum it up?

Also, if I follow the instructions on the neovim website to clone the latest stable release or nightly, and build it, that won't update anything in my current neovim folder structure until I "install" it. Correct? Just want to make sure I don't break anything if the build doesn't work.

sindrets commented 1 year ago

If you use nightly builds you are expected to keep in sync with upstream master. There're two simple ways to avoid the problem you are facing here:

  1. If you use nightly builds: always update your nvim install the same time you update your plugins. Breaking changes happen when you roll with nightly releases, and we plugin maintainers will have to push fixes for API incompatibilities.
  2. Use stable nvim releases. All sensible plugins will work with stable releases (as long as it meets some minimum compatible version. For diffview.nvim that is v0.7.0).

The problem here isn't that we dropped support for nvim__get_hl_defs. It's still supported for ≤ v0.9.0. The problem is that you were running an out-of-date nightly install that reported "My API version is up-to-date with v0.9.0" when that was not the case.

Also, if I follow the instructions on the neovim website to clone the latest stable release or nightly, and build it, that won't update anything in my current neovim folder structure until I "install" it. Correct?

Correct. Building software (conventionally) does not install it. You would have to run sudo make install after the build (assuming Unix) to perform the installation.