Tidy API and document scopes

This commit is contained in:
Ben Jackson 2018-05-20 20:57:45 +01:00
commit e5405ac059
3 changed files with 12 additions and 5 deletions

View file

@ -119,6 +119,6 @@ class DebugAdapterConnection( object ):
message[ 'message' ] ) )
elif message[ 'type' ] == 'event':
method = '_OnEvent_' + message[ 'event' ]
method = 'OnEvent_' + message[ 'event' ]
if method in dir( self._handler ) and getattr( self._handler, method ):
getattr( self._handler, method )( message )

View file

@ -171,7 +171,7 @@ class DebugSession( object ):
},
} )
def _OnEvent_initialized( self, message ):
def OnEvent_initialized( self, message ):
self._connection.DoRequest( None, {
'command': 'setFunctionBreakpoints',
'arguments': {
@ -186,14 +186,14 @@ class DebugSession( object ):
} )
def _OnEvent_output( self, message ):
def OnEvent_output( self, message ):
with utils.ModifiableScratchBuffer( self._outputBuffer ):
t = [ message[ 'body' ][ 'category' ] + ':' + '-' * 20 ]
t += message[ 'body' ][ 'output' ].splitlines()
self._outputBuffer.append( t, 0 )
def _OnEvent_stopped( self, message ):
def OnEvent_stopped( self, message ):
self._currentThread = message[ 'body' ][ 'threadId' ]
def threads_printer( message ):

View file

@ -23,9 +23,16 @@ class VariablesView( object ):
def __init__( self, connection, buf ):
self._buf = buf
self._connection = connection
self._scopes = []
self._line_to_variable = {}
# This is actually the tree (scopes are alwyas the root)
# it's just a list of DAP scope dicts, with one magic key (_variables)
# _variables is a list of DAP variable with the same magic key
#
# If _variables is present, then we have requested and should display the
# children. Otherwise, we haven't or shouldn't.
self._scopes = []
vim.current.buffer = buf
vim.command(
'nnoremap <buffer> <CR> :call vimspector#ExpandVariable()<CR>' )