From 83ecbe1aed98ddc2a9516f292937ea657a81e918 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sun, 16 Dec 2018 19:14:26 +0000 Subject: [PATCH] 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 --- python3/vimspector/debug_session.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index 42e66b5..d86eeff 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -204,7 +204,7 @@ class DebugSession( object ): self._variablesView.Reset() self._outputView.Reset() vim.current.tabpage = self._uiTab - vim.command( 'tabclose' ) + vim.command( 'tabclose!' ) vim.eval( 'vimspector#internal#job#Reset()' ) vim.eval( 'vimspector#internal#state#Reset()' ) @@ -350,16 +350,20 @@ class DebugSession( object ): "vimspector#internal#job#StartDebugSession( {0} )".format( json.dumps( self._adapter ) ) ) - self._connection = debug_adapter_connection.DebugAdapterConnection( - self, - channel_send_func ) + if channel_send_func is None: + self._logger.error( "Unable to start debug server" ) + 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( 'autocmd!' ) - vim.command( 'autocmd VimLeavePre * py3 _vimspector_session.CloseDown()' ) - vim.command( 'augroup END' ) + vim.command( 'augroup vimspector_cleanup' ) + vim.command( 'autocmd!' ) + vim.command( 'autocmd VimLeavePre * py3 ' + '_vimspector_session.CloseDown()' ) + vim.command( 'augroup END' ) def CloseDown( self ): # We have to use a dict because of python's scoping/assignment rules (state