-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restoring a session whilst using nvim-tree causes invalid buffer error #161
Comments
Can confirm. I use |
For a bit more context if needed, this issue seems to be very related to I've switched to lazy loading nvim tree and that seems to at least avoid the issue 😅 |
Funilly enough the error happens during gitsigns buffer validation checks: local attach = async(function(cbuf: integer)
await(scheduler())
cbuf = cbuf or current_buf()
if cache[cbuf] then
dprint('Already attached', cbuf, 'attach')
return
end
dprint('Attaching', cbuf, 'attach')
if api.nvim_buf_line_count(cbuf) > config.max_file_length then -- ERROR HERE
dprint('Exceeds max_file_length', cbuf, 'attach')
return
end
if api.nvim_buf_get_option(cbuf, 'buftype') ~= '' then
dprint('Non-normal buffer', cbuf, 'attach')
return
end
I guess we need to tweak the ordering and maybe add another check. |
I am totally assuming... Also, it is related with maybe closed floating windows, not sure if nvim-tree use floating window. The source that calls as I saw https://github.com/lewis6991/gitsigns.nvim/blob/main/lua/gitsigns.lua#L777 list all buffers but on async, the buffer does not exist later. for _, buf in ipairs(api.nvim_list_bufs()) do
if api.nvim_buf_is_valid(buf) and
api.nvim_buf_is_loaded(buf) and
api.nvim_buf_get_name(buf) ~= '' then
await(attach(buf))
await(scheduler())
end
end |
I did a speculative fix by just checking the buffer is loaded. Let me know if this fixes the issue. |
Just gave it a shot and still seems to persist unfortunately |
still having the issue |
Arggh, there was a missing |
I am still having the issue, after reading the docs looks like it is related to deleted buffers as unloaded buffer returns 0
|
We shouldn't reach |
it is working now! thanks |
Just tried it and it's also solved on my end 👍🏿 I can close this out now? |
Describe the bug
When loading up nvim with https://github.com/kyazdani42/nvim-tree.lua with a session immediately loaded
gitsigns
errors reporting.To Reproduce
init.lua:
Steps to reproduce the behavior:
nvim
inside a directorymksession
nvim -u minimal.lua -S
Observed output
Error messages, logs, etc
output of
:lua require('gitsigns').debug_messages()
.Screenshots
If applicable, add screenshots to help explain your problem or to capture error messages.
Additional context
System: Ubuntu 20.10
Neovim version:
The text was updated successfully, but these errors were encountered: