Reset when closing the tab

You can now kill vimspector sesssion by closing the vimspector session
tab, rather than this causing an ugly backtrace
This commit is contained in:
Ben Jackson 2021-04-03 19:55:19 +01:00
commit 7a8f479f66

View file

@ -405,27 +405,26 @@ class DebugSession( object ):
def _Reset( self ): def _Reset( self ):
self._logger.info( "Debugging complete." ) self._logger.info( "Debugging complete." )
if self._uiTab: if self._HasUI():
self._logger.debug( "Clearing down UI" ) self._logger.debug( "Clearing down UI" )
del vim.vars[ 'vimspector_session_windows' ]
vim.current.tabpage = self._uiTab vim.current.tabpage = self._uiTab
self._splash_screen = utils.HideSplash( self._api_prefix, self._splash_screen = utils.HideSplash( self._api_prefix,
self._splash_screen ) self._splash_screen )
self._stackTraceView.Reset() self._stackTraceView.Reset()
self._variablesView.Reset() self._variablesView.Reset()
self._outputView.Reset() self._outputView.Reset()
self._codeView.Reset() self._codeView.Reset()
vim.command( 'au! VimspectorReset TabClose <buffer>' )
vim.command( 'tabclose!' ) vim.command( 'tabclose!' )
vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
self._stackTraceView = None del vim.vars[ 'vimspector_session_windows' ]
self._variablesView = None vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
self._outputView = None self._stackTraceView = None
self._codeView = None self._variablesView = None
self._remote_term = None self._outputView = None
self._uiTab = None self._codeView = None
self._remote_term = None
self._uiTab = None
# make sure that we're displaying signs in any still-open buffers # make sure that we're displaying signs in any still-open buffers
self._breakpoints.UpdateUI() self._breakpoints.UpdateUI()
@ -668,6 +667,10 @@ class DebugSession( object ):
def _SetUpUI( self ): def _SetUpUI( self ):
vim.command( 'tab split' ) vim.command( 'tab split' )
self._uiTab = vim.current.tabpage self._uiTab = vim.current.tabpage
vim.command( 'augroup VimspectorReset' )
vim.command( 'au TabClosed <buffer> call vimspector#Reset()' )
vim.command( 'augroup END' )
mode = settings.Get( 'ui_mode' ) mode = settings.Get( 'ui_mode' )