vimspector icon indicating copy to clipboard operation
vimspector copied to clipboard

Closing vimspector tab can raise error or close wrong tab

Open alps2006 opened this issue 2 years ago • 3 comments

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:

  1. Launch a debugger.
  2. Run a command tabpagenr()-1 tabnew
  3. 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

alps2006 avatar May 09 '23 15:05 alps2006

The snippet in

https://github.com/puremourning/vimspector/blob/6d818bb04381c41a5a3fbdd0063cc0bff2a5cfb8/autoload/vimspector/internal/state.vim#L107

alps2006 avatar May 09 '23 15:05 alps2006

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.

puremourning avatar May 10 '23 08:05 puremourning

I think this actually broken in Vim too, but in a different (worse?) way. I think we end up closing the wrong tab sometimes :(

puremourning avatar Jul 19 '23 20:07 puremourning