Closed avegancafe closed 5 months ago
Are you setting foldmethod
anywhere in your config?
Unsure if this is related, but after updating Neogit to the latest commit (have not updated it for a few days) on the nightly
branch in my Windows 11 VM, I am getting this error when I open a buffer or window:
Error executing luv callback:
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...pData/Local/nvim-data/lazy/neogit/lua/neogit/process.lua:364: E5560: Vimscript function must not be called in a lua loop callback
stack traceback:
[C]: in function 'error'
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'callback'
...vim-data/lazy/plenary.nvim/lua/plenary/async/control.lua:101: in function 'returned_function'
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:31: in function 'callback_or_next'
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step'
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute'
.../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:118: in function 'fn'
...Data/Local/nvim-data/lazy/neogit/lua/neogit/lib/util.lua:520: in function <...Data/Local/nvim-data/lazy/neogit/lua/neogit/lib/util.lua:517>
This error does not occur on Linux for me.
Hmm. Thats the debounce, which is only called when refreshing the status buffer... ugh, windows.
Ok, windows or wsl?
ugh, windows.
As someone who's had a lot of trouble with having to debug Windows-specific bugs in the past as a Linux user, I fully relate 😆
Ok, windows or wsl?
Windows, not WSL.
I wonder why this is only on windows.. If you have time and feel like bisecting (haha), I'd appreciate it, since I don't have access to a windows machine/vm. Otherwise I'll try to get my hands on one at some point.
I wonder why this is only on windows.. If you have time and feel like bisecting (haha), I'd appreciate it, since I don't have access to a windows machine/vm. Otherwise I'll try to get my hands on one at some point.
Bisect leads me to commit ff2df2de4d7c0c2cdb8f1a7c2b665eb4b5a2d096
I should clarify, during the bisect, I came across a different, equally strange error where doing :Neogit
leads me to an empty buffer instead of the usual. It didn't error, but it didn't do anything either. I counted it as a bad commit in the bisect. Seems like the comment where that starts happening is the same commit as the one I linked above.
After more bisecting, seems like the commit where the blank buffer is replaced by an error is commit d62fd23ec7e7f38ce438aad76daf4284a6e6a0b5
Yeah, right around there I was changing the order-of-operations with respect to opening the buffer and gathering repo state. Previously, we did repo state first, then opened the buffer as a callback. This worked great, unless you specified a different CWD for neogit. I used vim.fn.lcd()
before opening neogit, which changed the wrong window.
Now we do it in the right order, but.. well, I still don't understand why this would only fail on windows.
@CKolkey for what it's worth I'm not on windows I'm on macos. But yes I'm setting my foldmethod to expr
in my config
@CKolkey for what it's worth I'm not on windows I'm on macos. But yes I'm setting my foldmethod to
expr
in my config
No worries, your issue is an easy fix: set the foldmethod to manual more aggressively, in case something else messed with it after I opened the window. I'll push that in a bit
Ohh okay sounds good!
@CKolkey I'm also getting the E5560: Vimscript function must not be called in a lua loop callback
error, and it happens every time I open Neogit from a tab where I've used :tcd
to change the working directory. Using either :cd
or :lcd
doesn't trigger the error. This is on both macOS and Linux.
After a bunch of debugging and troubleshooting, I believe I've managed to figure out the core issue, and it's a bug with Neovim itself: https://github.com/neovim/neovim/issues/28213. If any plugin (including Neogit itself) calls vim.api.nvim_buf_call
between the vim.cmd.lcd
call and the initial refresh of the buffer, or if Neovim internally opens the temporary "autocmd window" for any reason, then the window-local cwd for the status window will be lost. This then means that the git.repo
access needs to create a new Repo
instance, since the cwd changed, which then needs to find the git root dir, which it does by calling vim.fn.jobstart
, which errors, because the original status buffer refresh call was debounced and is thus in a luv loop callback.
If I disable all my plugins except for Neogit, then I can only get it to error once, if I first change the tab-local cwd with :tcd
and then only run :Neogit
. Subsequent :Neogit
calls then don't error. If I enable all my plugins, then it errors every time.
Pushed a commit to nightly
that changes the order of operations regarding calling lcd()
and drawing the buffer. I can't seem to reproduce this error - do you mind checking to see if this helps? I moved the call to after the last buffer:call()
method during buffer creation.
@CKolkey That seems to fix it for me, I'm not getting the error anymore :+1:
Hell yea - all thanks to your reporting 😇
@famiu are you still seeing issues on windows?
I stopped getting this error now @CKolkey ! This is maybe a different ticket, but do you know what setting could be set that'd cause these folds to render with the default fold preview? This doesn't happen on main, only nightly
@famiu are you still seeing issues on windows?
Seemed to be fixed as far as I can tell
I stopped getting this error now @CKolkey ! This is maybe a different ticket, but do you know what setting could be set that'd cause these folds to render with the default fold preview? This doesn't happen on main, only nightly
Are you setting vim.wo.foldtext
anywhere? For neogit buffers, it should be an empty string. https://github.com/NeogitOrg/neogit/blob/abbb35a48f47ebd786ef44174b080c61e7fb7cf0/lua/neogit/lib/buffer.lua#L633
That'll leave the text as-is in the buffer, with highlights and everything. I'm going to close this, as this issue is pretty far from where we started, but if you still have issues with folds, feel free to open a new issue :)
@CKolkey I do not, the only fold settings I have are foldmethod=expr
and foldlevelstart=99
, I tried removing these though and still see the issue
Description
If I open neogit, and then close it, and open it again, all subsequent neogit tabs will throw this error:
Neovim version
NVIM v0.10.0-dev-2104+gfd2ed024c-Homebrew Build type: Release LuaJIT 2.1.1710088188 Run "nvim -V1 -v" for more info
Operating system and version
macOS 14.4
Steps to reproduce
Update branch to nightly with lazy.nvim
Expected behavior
No response
Actual behavior
There are a ton of errors and I'm not able to use any of the neogit functions
Minimal config