breakpoints list: fix listing while debugging

Also, open the quickfix list when listing breakpoints, and add a test
This commit is contained in:
Ben Jackson 2020-05-12 19:29:17 +01:00
commit 8c4112cd1f
3 changed files with 84 additions and 3 deletions

View file

@ -82,7 +82,7 @@ class ProjectBreakpoints( object ):
# FIXME: If the adapter type changes, we should probably forget this ?
def ListBreakpoints( self ):
def BreakpointsAsQuickFix( self ):
# FIXME: Handling of breakpoints is a mess, split between _codeView and this
# object. This makes no sense and should be centralised so that we don't
# have this duplication and bug factory.
@ -115,7 +115,8 @@ class ProjectBreakpoints( object ):
bp[ 'options' ] ),
} )
vim.eval( 'setqflist( {} )'.format( json.dumps( qf ) ) )
return qf
def ClearBreakpoints( self ):
# These are the user-entered breakpoints.

View file

@ -979,7 +979,13 @@ class DebugSession( object ):
self._stackTraceView.OnStopped( event )
def ListBreakpoints( self ):
return self._breakpoints.ListBreakpoints()
if self._connection:
qf = self._codeView.BreakpointsAsQuickFix()
else:
qf = self._breakpoints.BreakpointsAsQuickFix()
vim.eval( 'setqflist( {} )'.format( json.dumps( qf ) ) )
vim.command( 'copen' )
def ToggleBreakpoint( self, options ):
return self._breakpoints.ToggleBreakpoint( options )