Imrpove console evaluation somewhat. Fix restart bug not resetting connection in the console view

This commit is contained in:
Ben Jackson 2018-12-19 01:33:21 +00:00
commit 256579c4d8
3 changed files with 11 additions and 4 deletions

View file

@ -168,6 +168,7 @@ class DebugSession( object ):
# FIXME: Encapsulation
self._stackTraceView._connection = self._connection
self._variablesView._connection = self._connection
self._outputView._connection = self._connection
if self._connection:
self._StopDebugAdapter( start )

View file

@ -83,10 +83,13 @@ class OutputView( object ):
return
console = self._buffers[ 'Console' ]
utils.AppendToBuffer( console, expression )
utils.AppendToBuffer( console, 'Evaluating: ' + expression )
def print_result( message ):
utils.AppendToBuffer( console, message[ 'body' ][ 'result' ] )
utils.AppendToBuffer( console,
'Evaluated: ' + expression )
utils.AppendToBuffer( console,
' Result: ' + message[ 'body' ][ 'result' ] )
self._connection.DoRequest( print_result, {
'command': 'evaluate',
@ -110,7 +113,7 @@ class OutputView( object ):
'vimspector.Console',
'> ',
'vimspector#EvaluateConsole',
hidden = True )
hidden=True )
else:
utils.SetUpHiddenBuffer( self._buffers[ category ],
'vimspector.Output:{0}'.format( category ) )

View file

@ -201,7 +201,7 @@ def AskForInput( prompt ):
return vim.eval( "input( '{0}' )".format( Escape( prompt ) ) )
def AppendToBuffer( buf, line_or_lines ):
def AppendToBuffer( buf, line_or_lines, modified=False ):
# After clearing the buffer (using buf[:] = None) there is always a single
# empty line in the buffer object and no "is empty" method.
if len( buf ) > 1 or buf[ 0 ]:
@ -214,6 +214,9 @@ def AppendToBuffer( buf, line_or_lines ):
line = 1
buf[:] = line_or_lines
if not modified:
buf.options[ 'modified' ] = False
# Return the first Vim line number (1-based) that we just set.
return line