lspsaga.nvim
lspsaga.nvim copied to clipboard
Closing buffer while 'Outline' is open throws errors
Describe the bug
14:29:10 msg_show Error executing lua callback: ...ocal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/window.lua:154: 'width' key must be a positive Integer
stack traceback:
[C]: in function 'nvim_open_win'
...ocal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/window.lua:154: in function 'new_float'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:351: in function 'create_preview_win'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:423: in function <...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:408>
Steps to reproduce
- open a file
- enable outline
- close that file
Expected behavior
I expect that the outline should just close alongside that file. Not throwing errors.
Neovim version (nvim -v)
latest
lspsaga commit
latest
Terminal name/version
kitty
@glepnir still happens:
Error 13:48:21 msg_show.lua_error Error executing Lua callback: ...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:30: Invalid 'group': 128
stack traceback:
[C]: in function 'nvim_get_autocmds'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:30: in function 'clean_ctx'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:559: in function 'outline'
...share/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/init.lua:222: in function 'outline'
...cal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/command.lua:50: in function <...cal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/command.lua:49>
...cal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/command.lua:74: in function 'load_command'
...e/.local/share/nvim/lazy/lspsaga.nvim/plugin/lspsaga.lua:8: in function <...e/.local/share/nvim/lazy/lspsaga.nvim/plugin/lspsaga.lua:7>
I can't reproduce with you reproduce now
1. open a file
2. open outline
3. move cursor back to file
4. close file
Try this
- open two files
- navigate to either one
- open outline
- cursor on file
- close outline
if buffer delete then the outline also delete is reasonable? this way easy to solve issue.
If that's the fix, go for it, but what could be nice to have is:
While outline is on inside file, and you close that file it should either:
- Stay open and be updated with the new file your cursor is inside
- Close when no files available
yes ..that's the correct way.. but a bit trouble . let me try some change tho.
yes ..that's the correct way.. but a bit trouble . let me try some change tho.
I updated my latest comment
a simple test when you open two window when close buffer in one window it will jump to another window ..
a simple test when you open two window when close buffer in one window it will jump to another window ..
Yes if another file exists otherwise outline should close
So this is where it gets tricky. if can keep window not close it's easy to do.
Let's split it up in two:
- bug fix
- enchanement
right now, just close outline if file closes.
then, if time and resources, focus on the enhancement which is the tricky part.
What do you say?
maybe can use bd# to keep window not close then do refresh .. but there have a bug i need find it out tomorrow.
Encountered the same issue.
- Open a file
-
Lspsaga outline - back cursor to the file
- press
q
to quit the file, an error has occurred.
Perhaps it's because I used mini.bufremove in Lazyvim.
Hitting this error:
Error detected while processing WinEnter Autocommands for "*":
Error executing lua callback: ...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:30: Invalid 'group': 52
stack traceback:
[C]: in function 'nvim_get_autocmds'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:30: in function 'clean_ctx'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:494: in function <...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:490>
I think it's because of deleting the augroup before calling clean_ctx
https://github.com/nvimdev/lspsaga.nvim/blob/b1b140aa20a0cf353cd3e282870429b48b30a169/lua/lspsaga/symbol/outline.lua#L493-L494
Since clean_ctx
tries to look up autocmds by the group id
https://github.com/nvimdev/lspsaga.nvim/blob/b1b140aa20a0cf353cd3e282870429b48b30a169/lua/lspsaga/symbol/outline.lua#L26-L36
@glepnir I think my commit above addresses this error, which has more to do with referencing a deleted augroup.
However, I'm unable to consistently reproduce or understand this error also shown below. Sometimes it occurs and other times it doesn't. I believe it happens because the auto close check fails leaving the outline buffer as the last window. Then the preview window rendering fails because its width arg becomes 0. Somehow this condition can be met without actually triggering the creation of the scratch buffer in place of the outline. Maybe it has to do with the choice of autocommand event? Thoughts?
Error detected while processing CursorMoved Autocommands for "<buffer=25>":
Error executing lua callback: ...uments/code/nvim-dev/lspsaga.nvim/lua/lspsaga/window.lua:157: 'width' key must be a positive Integer
stack traceback:
[C]: in function 'nvim_open_win'
...uments/code/nvim-dev/lspsaga.nvim/lua/lspsaga/window.lua:157: in function 'new_float'
...ode/nvim-dev/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:374: in function 'create_preview_win'
...ode/nvim-dev/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:452: in function <...ode/nvim-dev/lspsaga.nvim/lua/lspsaga/symbol/outline.lua:433>
Actually looks like #api.nvim_list_wins() == 1
condition is failing. Not sure why the list of window handles isn't properly tracking. It will still show multiple window handles despite me only having a single window open. Might have to try with a more minimal config to make sure something else isn't the problem.