Closing vimspector tab can raise error or close wrong tab
Description
Debugger quit exceptionally when closing a new tab that inserted before vimspector tab.
I found that vimspector session can be queried by tabpagenr in neovim, but that inserting a new tab can lead tabpagenr changed.
Works in vim?
Only broken in Neovim
Works with clean config?
Yes
Sample project works?
Reproducable with sample project
Minimal Reproduction
List of steps to reproduce:
- Launch a debugger.
- Run a command
tabpagenr()-1 tabnew - Close the new tab.
Expected Behaviour
Debugger don't quit.
Actual Behaviour
Debugger quit.
Additional information
No response
Installation Type
Plugin Manager (git clone)
Vimspector version
latest
Debug Info
No response
Log file
No response
Vim version
nvim 8.x
Python version
No response
Neovim diagnostics
No response
Operating System
No response
Declaration
- [X] I have read and understood CONTRIBUTING.md
- [X] I have read and understood the CODE_OF_CONDUCT.md
The snippet in
https://github.com/puremourning/vimspector/blob/6d818bb04381c41a5a3fbdd0063cc0bff2a5cfb8/autoload/vimspector/internal/state.vim#L107
Thanks for the report.
I'm not sure this is fixable because neovim... https://github.com/neovim/neovim/issues/16327. Feel free to badger them to fix this - it's the only way.
It seems that although tabs aren't correctly invalidated, their tab numbers are updated before TabClosed is called, so there's no way for Vimspector to know that you closed a tab which wasn't the vimspector tab but is now.
I think this actually broken in Vim too, but in a different (worse?) way. I think we end up closing the wrong tab sometimes :(