Trivial support for function breakpoints

You can't see them and you can't disable/cancel them.
This commit is contained in:
Ben Jackson 2018-05-28 19:36:50 +01:00
commit 46cdedc648
2 changed files with 30 additions and 0 deletions

View file

@ -52,6 +52,7 @@ class DebugSession( object ):
# - the split of responsibility between this object and the CodeView is
# messy and ill-defined.
self._line_breakpoints = defaultdict( list )
self._func_breakpoints = []
self._configuration = None
vim.command( 'sign define vimspectorBP text==> texthl=Error' )
@ -87,11 +88,23 @@ class DebugSession( object ):
# 'logMessage': ...
} )
self._UpdateUIBreakpoints()
def _UpdateUIBreakpoints( self ):
if self._connection:
self._SendBreakpoints()
else:
self._ShowBreakpoints()
def AddFunctionBreakpoint( self, function ):
self._func_breakpoints.append( {
'state': 'ENABLED',
'function': function,
} )
# TODO: We don't really have aanything to update here, but if we're going to
# have a UI list of them we should update that at this point
self._UpdateUIBreakpoints()
def Start( self, configuration = None ):
self._configuration = None
@ -468,6 +481,19 @@ class DebugSession( object ):
}
)
self._connection.DoRequest(
functools.partial( self._UpdateBreakpoints, None ),
{
'command': 'setFunctionBreakpoints',
'arguments': {
'breakpoints': [
{ 'name': bp[ 'function' ] }
for bp in self._func_breakpoints if bp[ 'state' ] == 'ENABLED'
],
}
}
)
def _ShowBreakpoints( self ):
for file_name, line_breakpoints in self._line_breakpoints.items():
for bp in line_breakpoints: