Fix tracebacks when the debug adapter dies very quickly

This commit is contained in:
Ben Jackson 2020-01-02 23:55:46 +00:00
commit 37fefafe35
4 changed files with 28 additions and 14 deletions

View file

@ -879,7 +879,11 @@ class DebugSession( object ):
status )
self.Clear()
self._connection.Reset()
if self._connection is not None:
# Can be None if the server dies _before_ StartDebugSession vim function
# returns
self._connection.Reset()
self._stackTraceView.ConnectionClosed()
self._variablesView.ConnectionClosed()
self._outputView.ConnectionClosed()

View file

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from vimspector import utils
from vimspector import utils,install
import vim
import json
@ -49,10 +49,7 @@ class OutputView( object ):
for b in set( BUFFER_MAP.values() ):
self._CreateBuffer( b )
self._CreateBuffer(
'Vimspector',
file_name = vim.eval( 'expand( "~/.vimspector.log" )' ) )
self._CreateBuffer( 'Vimspector', file_name = utils.LOG_FILE )
self._ShowOutput( 'Console' )
def Print( self, categroy, text ):
@ -161,6 +158,10 @@ class OutputView( object ):
if file_name is not None:
assert cmd is None
if install.GetOS() == "windows":
# FIXME: Can't display fiels in windows (yet?)
return
cmd = [ 'tail', '-F', '-n', '+1', '--', file_name ]
if cmd is not None:

View file

@ -23,8 +23,10 @@ import string
import functools
_log_handler = logging.FileHandler( os.path.expanduser( '~/.vimspector.log' ),
mode = 'w' )
LOG_FILE = os.path.expanduser( os.path.join( '~', '.vimspector.log') )
_log_handler = logging.FileHandler( LOG_FILE, mode = 'w' )
_log_handler.setFormatter(
logging.Formatter( '%(asctime)s - %(levelname)s - %(message)s' ) )