Improve cleanup by forcefully closing the tab. This could leave unsaved buffers hidden, but it's not easy to know what better to do. Mainly issues happen due to our own buffers being marked as modified for some rason. TODO: fix that instead

This commit is contained in:
Ben Jackson 2018-12-16 19:14:26 +00:00
commit 83ecbe1aed

View file

@ -204,7 +204,7 @@ class DebugSession( object ):
self._variablesView.Reset() self._variablesView.Reset()
self._outputView.Reset() self._outputView.Reset()
vim.current.tabpage = self._uiTab vim.current.tabpage = self._uiTab
vim.command( 'tabclose' ) vim.command( 'tabclose!' )
vim.eval( 'vimspector#internal#job#Reset()' ) vim.eval( 'vimspector#internal#job#Reset()' )
vim.eval( 'vimspector#internal#state#Reset()' ) vim.eval( 'vimspector#internal#state#Reset()' )
@ -350,16 +350,20 @@ class DebugSession( object ):
"vimspector#internal#job#StartDebugSession( {0} )".format( "vimspector#internal#job#StartDebugSession( {0} )".format(
json.dumps( self._adapter ) ) ) json.dumps( self._adapter ) ) )
self._connection = debug_adapter_connection.DebugAdapterConnection( if channel_send_func is None:
self, self._logger.error( "Unable to start debug server" )
channel_send_func ) else:
self._connection = debug_adapter_connection.DebugAdapterConnection(
self,
channel_send_func )
self._logger.info( 'Debug Adapter Started' ) self._logger.info( 'Debug Adapter Started' )
vim.command( 'augroup vimspector_cleanup' ) vim.command( 'augroup vimspector_cleanup' )
vim.command( 'autocmd!' ) vim.command( 'autocmd!' )
vim.command( 'autocmd VimLeavePre * py3 _vimspector_session.CloseDown()' ) vim.command( 'autocmd VimLeavePre * py3 '
vim.command( 'augroup END' ) '_vimspector_session.CloseDown()' )
vim.command( 'augroup END' )
def CloseDown( self ): def CloseDown( self ):
# We have to use a dict because of python's scoping/assignment rules (state # We have to use a dict because of python's scoping/assignment rules (state