Tidy up clearing breakpoints
This commit is contained in:
parent
e6904acddd
commit
9fc0a16912
3 changed files with 14 additions and 17 deletions
|
|
@ -98,6 +98,12 @@ class ProjectBreakpoints( object ):
|
||||||
|
|
||||||
def ClearBreakpoints( self ):
|
def ClearBreakpoints( self ):
|
||||||
# These are the user-entered breakpoints.
|
# These are the user-entered breakpoints.
|
||||||
|
for file_name, breakpoints in self._line_breakpoints.items():
|
||||||
|
for bp in breakpoints:
|
||||||
|
if 'sign_id' in bp:
|
||||||
|
vim.command( 'sign unplace {0} group=VimspectorBP'.format(
|
||||||
|
bp[ 'sign_id' ] ) )
|
||||||
|
|
||||||
self._line_breakpoints = defaultdict( list )
|
self._line_breakpoints = defaultdict( list )
|
||||||
self._func_breakpoints = []
|
self._func_breakpoints = []
|
||||||
self._exceptionBreakpoints = None
|
self._exceptionBreakpoints = None
|
||||||
|
|
@ -177,14 +183,14 @@ class ProjectBreakpoints( object ):
|
||||||
for file_name, line_breakpoints in self._line_breakpoints.items():
|
for file_name, line_breakpoints in self._line_breakpoints.items():
|
||||||
breakpoints = []
|
breakpoints = []
|
||||||
for bp in line_breakpoints:
|
for bp in line_breakpoints:
|
||||||
if bp[ 'state' ] != 'ENABLED':
|
|
||||||
continue
|
|
||||||
|
|
||||||
if 'sign_id' in bp:
|
if 'sign_id' in bp:
|
||||||
vim.command( 'sign unplace {0} group=VimspectorBP'.format(
|
vim.command( 'sign unplace {0} group=VimspectorBP'.format(
|
||||||
bp[ 'sign_id' ] ) )
|
bp[ 'sign_id' ] ) )
|
||||||
del bp[ 'sign_id' ]
|
del bp[ 'sign_id' ]
|
||||||
|
|
||||||
|
if bp[ 'state' ] != 'ENABLED':
|
||||||
|
continue
|
||||||
|
|
||||||
breakpoints.append( { 'line': bp[ 'line' ] } )
|
breakpoints.append( { 'line': bp[ 'line' ] } )
|
||||||
|
|
||||||
source = {
|
source = {
|
||||||
|
|
|
||||||
|
|
@ -128,23 +128,11 @@ class CodeView( object ):
|
||||||
# Not found. Assume new
|
# Not found. Assume new
|
||||||
self.AddBreakpoints( None, [ bp ] )
|
self.AddBreakpoints( None, [ bp ] )
|
||||||
|
|
||||||
def DeleteBreakpoint( self, bp ):
|
|
||||||
if 'id' not in bp:
|
|
||||||
return
|
|
||||||
|
|
||||||
for _, breakpoint_list in self._breakpoints.items():
|
|
||||||
for index, breakpoint in enumerate( breakpoint_list ):
|
|
||||||
if 'id' in breakpoint and breakpoint[ 'id' ] == bp[ 'id' ]:
|
|
||||||
del breakpoint_list[ index ]
|
|
||||||
return
|
|
||||||
|
|
||||||
# Not found. Shrug.
|
|
||||||
|
|
||||||
def _UndisplaySigns( self ):
|
def _UndisplaySigns( self ):
|
||||||
for sign_id in self._signs[ 'breakpoints' ]:
|
for sign_id in self._signs[ 'breakpoints' ]:
|
||||||
vim.command( 'sign unplace {} group=VimspectorCode'.format( sign_id ) )
|
vim.command( 'sign unplace {} group=VimspectorCode'.format( sign_id ) )
|
||||||
|
|
||||||
self._signs[ 'breakpoints' ].clear()
|
self._signs[ 'breakpoints' ] = []
|
||||||
|
|
||||||
def ClearBreakpoints( self ):
|
def ClearBreakpoints( self ):
|
||||||
self._UndisplaySigns()
|
self._UndisplaySigns()
|
||||||
|
|
|
||||||
|
|
@ -776,6 +776,9 @@ class DebugSession( object ):
|
||||||
return self._breakpoints.ToggleBreakpoint()
|
return self._breakpoints.ToggleBreakpoint()
|
||||||
|
|
||||||
def ClearBreakpoints( self ):
|
def ClearBreakpoints( self ):
|
||||||
|
if self._connection:
|
||||||
|
self._codeView.ClearBreakpoints()
|
||||||
|
|
||||||
return self._breakpoints.ClearBreakpoints()
|
return self._breakpoints.ClearBreakpoints()
|
||||||
|
|
||||||
def AddFunctionBreakpoint( self, function ):
|
def AddFunctionBreakpoint( self, function ):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue