When using nvim-tree's ability to delete a file, it's logic appears to force close the buffer of that corresponding file (if open). When this file is the current buffer open with lspsaga enabled, I can consistently see an error which traces back to lspsaga's lightbulb.lua file.
Here is the error trace:
...testfile.lua was properly removed.
Error executing vim.schedule lua callback: ...r/neovim/0.9.1/share/nvim/runtime/lua/vim/diagnostic.lua:55: Invalid buffer id: 10
stack traceback:
[C]: in function 'nvim_create_autocmd'
...r/neovim/0.9.1/share/nvim/runtime/lua/vim/diagnostic.lua:55: in function '__index'
...r/neovim/0.9.1/share/nvim/runtime/lua/vim/diagnostic.lua:434: in function 'get'
...ovim/0.9.1/share/nvim/runtime/lua/vim/lsp/diagnostic.lua:294: in function 'get_line_diagnostics'
...er/opt/lspsaga.nvim/lua/lspsaga/codeaction/lightbulb.lua:59: in function 'render'
...er/opt/lspsaga.nvim/lua/lspsaga/codeaction/lightbulb.lua:83: in function <...er/opt/lspsaga.nvim/lua/lspsaga/codeaction/lightbulb.lua:
82>
To be clear, this bug comes up when using in conjunction with nvim-tree, however, I believe this specific case illustrates the need for a fix in the corresponding lines in lightbulb.lua. On line 82, it looks like it calls vim.schedule with render(buf). This render function (or the logic in the vim.schedule call) probably needs some logic to check whether the buffer is still valid.
Steps to reproduce
Use nvim-tree plugin & lspsaga
Create a new file & type some sample code
Open nvim-tree and press "d" to delete the file currently open
Witness error traced back to lspsaga's lightbulb.lua file
Expected behavior
There should be no error. Lspsaga logic should exit gracefully.
Describe the bug
When using nvim-tree's ability to delete a file, it's logic appears to force close the buffer of that corresponding file (if open). When this file is the current buffer open with lspsaga enabled, I can consistently see an error which traces back to lspsaga's
lightbulb.lua
file.Here is the error trace:
To be clear, this bug comes up when using in conjunction with nvim-tree, however, I believe this specific case illustrates the need for a fix in the corresponding lines in
lightbulb.lua
. On line 82, it looks like it callsvim.schedule
withrender(buf)
. This render function (or the logic in the vim.schedule call) probably needs some logic to check whether the buffer is still valid.Steps to reproduce
Use nvim-tree plugin & lspsaga
lightbulb.lua
fileExpected behavior
There should be no error. Lspsaga logic should exit gracefully.
Neovim version (nvim -v)
NVIM v0.9.1
lspsaga commit
3519a20 diagnostic show fix #1279
Terminal name/version
zsh 5.9