Breakpoints returned from servers rarely have source set

For line-breakpoints we already know it, so just use what we said
originally. For method breakpoints, we have no clue. While some servers
return a line, it could be in any file, so we just ignore them.
This commit is contained in:
Ben Jackson 2018-05-26 19:08:59 +01:00
commit 9d9c2214f3
2 changed files with 18 additions and 16 deletions

View file

@ -85,17 +85,17 @@ class CodeView( object ):
self._signs[ 'vimspectorPC' ] = None
def AddBreakpoints( self, breakpoints ):
def AddBreakpoints( self, source, breakpoints ):
for breakpoint in breakpoints:
if not breakpoint.get( 'verified', False ):
continue
if 'source' not in breakpoint:
self._logger.warn( 'source not in breakpoint {0}'.format(
json.dumps( breakpoint ) ) )
continue
if source:
breakpoint[ 'source' ] = source
else:
self._logger.warn( 'missing source in breakpoint {0}'.format(
json.dumps( breakpoint ) ) )
continue
self._breakpoints[ breakpoint[ 'source' ][ 'file' ] ].append(
self._breakpoints[ breakpoint[ 'source' ][ 'path' ] ].append(
breakpoint )
self._logger.debug( 'Breakpoints at this point: {0}'.format(

View file

@ -17,6 +17,7 @@ import logging
import vim
import json
import os
import functools
from collections import defaultdict
@ -213,8 +214,8 @@ class DebugSession( object ):
'arguments': self._configuration[ 'configuration' ]
} )
def _UpdateBreakpoints( self, message ):
self._codeView.AddBreakpoints( message[ 'body' ][ 'breakpoints' ] )
def _UpdateBreakpoints( self, source, message ):
self._codeView.AddBreakpoints( source, message[ 'body' ][ 'breakpoints' ] )
self._codeView.ShowBreakpoints()
def OnEvent_initialized( self, message ):
@ -222,15 +223,16 @@ class DebugSession( object ):
for file_name, line_breakpoints in self._breakpoints.items():
breakpoints = [ { 'line': line } for line in line_breakpoints.keys() ]
source = {
'name': os.path.basename( file_name ),
'path': file_name,
}
self._connection.DoRequest(
self._UpdateBreakpoints,
functools.partial( self._UpdateBreakpoints, source ),
{
'command': 'setBreakpoints',
'arguments': {
'source': {
'name': os.path.basename( file_name ),
'path': file_name,
},
'source': source,
'breakpoints': breakpoints,
'lines': [ line for line in line_breakpoints.keys() ],
'sourceModified': False,
@ -239,7 +241,7 @@ class DebugSession( object ):
)
self._connection.DoRequest(
self._UpdateBreakpoints,
functools.partial( self._UpdateBreakpoints, None ),
{
'command': 'setFunctionBreakpoints',
'arguments': {