Probably not working: allow unverified breakpoints

This commit is contained in:
Ben Jackson 2018-05-26 18:52:09 +01:00
commit 76f26551fb
2 changed files with 12 additions and 10 deletions

View file

@ -49,6 +49,7 @@ class CodeView( object ):
vim.command( 'sign define vimspectorPC text=>> texthl=Search' ) vim.command( 'sign define vimspectorPC text=>> texthl=Search' )
vim.command( 'sign define vimspectorBP text=>> texthl=Error' ) vim.command( 'sign define vimspectorBP text=>> texthl=Error' )
vim.command( 'sign define vimspectorBPDead text=>> texthl=Warning' )
def SetCurrentFrame( self, frame ): def SetCurrentFrame( self, frame ):
@ -95,7 +96,7 @@ class CodeView( object ):
continue continue
self._breakpoints[ breakpoint[ 'source' ][ 'file' ] ].append( self._breakpoints[ breakpoint[ 'source' ][ 'file' ] ].append(
breakpoint[ 'line' ] ) breakpoint )
self._logger.debug( 'Breakpoints at this point: {0}'.format( self._logger.debug( 'Breakpoints at this point: {0}'.format(
json.dumps( self._breakpoints, indent = 2 ) ) ) json.dumps( self._breakpoints, indent = 2 ) ) )
@ -107,20 +108,21 @@ class CodeView( object ):
self._signs[ 'breakpoints' ].clear() self._signs[ 'breakpoints' ].clear()
def ClearBreakpoints( self ): def ClearBreakpoints( self ):
self._UndisplaySigns(); self._UndisplaySigns()
self._breakpoints = defaultdict( list ) self._breakpoints = defaultdict( list )
def ShowBreakpoints( self ): def ShowBreakpoints( self ):
self._UndisplaySigns() self._UndisplaySigns()
for file_name, lines in self._breakpoints.items(): for file_name, breakpoints in self._breakpoints.items():
for line in lines: for breakpoint in breakpoints:
sign_id = self._next_sign_id sign_id = self._next_sign_id
self._next_sign_id += 1 self._next_sign_id += 1
self._signs[ 'breakpoints' ].append( sign_id ) self._signs[ 'breakpoints' ].append( sign_id )
vim.command( vim.command(
'sign place {0} line={1} name=vimspectorBP file={2}'.format( 'sign place {0} line={1} name={2} file={3}'.format(
sign_id, sign_id,
line, breakpoint[ 'line' ],
'vimspectorBP' if breakpoint[ 'verified' ] else 'vimspectorBPDead',
file_name ) ) file_name ) )

View file

@ -195,11 +195,11 @@ class DebugSession( object ):
self._logger.info( 'Debug Adapter Started' ) self._logger.info( 'Debug Adapter Started' )
def _Initialise( self, adapter_config, launch_config ): def _ConfigurationDone( self ):
self._logger.info( 'Initialising adapter with config {0}'.format( utils.UserMessage( "Debug adapter ready" )
json.dumps( launch_config ) ) )
self._connection.DoRequest( lambda msg: self._Launch( launch_config ), { def _Initialise( self ):
self._connection.DoRequest( lambda msg: self._ConfigurationDone(), {
'command': 'initialize', 'command': 'initialize',
'arguments': { 'arguments': {
'adapterID': self._configuration[ 'adapter' ].get( 'name', 'adapter' ), 'adapterID': self._configuration[ 'adapter' ].get( 'name', 'adapter' ),