Trivial support for function breakpoints
You can't see them and you can't disable/cancel them.
This commit is contained in:
parent
9baea25c46
commit
46cdedc648
2 changed files with 30 additions and 0 deletions
|
|
@ -39,6 +39,10 @@ function! vimspector#ToggleBreakpoint() abort
|
||||||
py3 _vimspector_session.ToggleBreakpoint()
|
py3 _vimspector_session.ToggleBreakpoint()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#AddFunctionBreakpoint( function ) abort
|
||||||
|
py3 _vimspector_session.AddFunctionBreakpoint( vim.eval( 'a:function' ) )
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! vimspector#StepOver() abort
|
function! vimspector#StepOver() abort
|
||||||
py3 _vimspector_session.StepOver()
|
py3 _vimspector_session.StepOver()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ class DebugSession( object ):
|
||||||
# - the split of responsibility between this object and the CodeView is
|
# - the split of responsibility between this object and the CodeView is
|
||||||
# messy and ill-defined.
|
# messy and ill-defined.
|
||||||
self._line_breakpoints = defaultdict( list )
|
self._line_breakpoints = defaultdict( list )
|
||||||
|
self._func_breakpoints = []
|
||||||
self._configuration = None
|
self._configuration = None
|
||||||
|
|
||||||
vim.command( 'sign define vimspectorBP text==> texthl=Error' )
|
vim.command( 'sign define vimspectorBP text==> texthl=Error' )
|
||||||
|
|
@ -87,11 +88,23 @@ class DebugSession( object ):
|
||||||
# 'logMessage': ...
|
# 'logMessage': ...
|
||||||
} )
|
} )
|
||||||
|
|
||||||
|
self._UpdateUIBreakpoints()
|
||||||
|
|
||||||
|
def _UpdateUIBreakpoints( self ):
|
||||||
if self._connection:
|
if self._connection:
|
||||||
self._SendBreakpoints()
|
self._SendBreakpoints()
|
||||||
else:
|
else:
|
||||||
self._ShowBreakpoints()
|
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 ):
|
def Start( self, configuration = None ):
|
||||||
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 ):
|
def _ShowBreakpoints( self ):
|
||||||
for file_name, line_breakpoints in self._line_breakpoints.items():
|
for file_name, line_breakpoints in self._line_breakpoints.items():
|
||||||
for bp in line_breakpoints:
|
for bp in line_breakpoints:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue