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:
parent
d814091692
commit
9d9c2214f3
2 changed files with 18 additions and 16 deletions
|
|
@ -85,17 +85,17 @@ class CodeView( object ):
|
||||||
self._signs[ 'vimspectorPC' ] = None
|
self._signs[ 'vimspectorPC' ] = None
|
||||||
|
|
||||||
|
|
||||||
def AddBreakpoints( self, breakpoints ):
|
def AddBreakpoints( self, source, breakpoints ):
|
||||||
for breakpoint in breakpoints:
|
for breakpoint in breakpoints:
|
||||||
if not breakpoint.get( 'verified', False ):
|
|
||||||
continue
|
|
||||||
|
|
||||||
if 'source' not in breakpoint:
|
if 'source' not in breakpoint:
|
||||||
self._logger.warn( 'source not in breakpoint {0}'.format(
|
if source:
|
||||||
|
breakpoint[ 'source' ] = source
|
||||||
|
else:
|
||||||
|
self._logger.warn( 'missing source in breakpoint {0}'.format(
|
||||||
json.dumps( breakpoint ) ) )
|
json.dumps( breakpoint ) ) )
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._breakpoints[ breakpoint[ 'source' ][ 'file' ] ].append(
|
self._breakpoints[ breakpoint[ 'source' ][ 'path' ] ].append(
|
||||||
breakpoint )
|
breakpoint )
|
||||||
|
|
||||||
self._logger.debug( 'Breakpoints at this point: {0}'.format(
|
self._logger.debug( 'Breakpoints at this point: {0}'.format(
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import logging
|
||||||
import vim
|
import vim
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import functools
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
@ -213,8 +214,8 @@ class DebugSession( object ):
|
||||||
'arguments': self._configuration[ 'configuration' ]
|
'arguments': self._configuration[ 'configuration' ]
|
||||||
} )
|
} )
|
||||||
|
|
||||||
def _UpdateBreakpoints( self, message ):
|
def _UpdateBreakpoints( self, source, message ):
|
||||||
self._codeView.AddBreakpoints( message[ 'body' ][ 'breakpoints' ] )
|
self._codeView.AddBreakpoints( source, message[ 'body' ][ 'breakpoints' ] )
|
||||||
self._codeView.ShowBreakpoints()
|
self._codeView.ShowBreakpoints()
|
||||||
|
|
||||||
def OnEvent_initialized( self, message ):
|
def OnEvent_initialized( self, message ):
|
||||||
|
|
@ -222,15 +223,16 @@ class DebugSession( object ):
|
||||||
|
|
||||||
for file_name, line_breakpoints in self._breakpoints.items():
|
for file_name, line_breakpoints in self._breakpoints.items():
|
||||||
breakpoints = [ { 'line': line } for line in line_breakpoints.keys() ]
|
breakpoints = [ { 'line': line } for line in line_breakpoints.keys() ]
|
||||||
|
source = {
|
||||||
|
'name': os.path.basename( file_name ),
|
||||||
|
'path': file_name,
|
||||||
|
}
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
self._UpdateBreakpoints,
|
functools.partial( self._UpdateBreakpoints, source ),
|
||||||
{
|
{
|
||||||
'command': 'setBreakpoints',
|
'command': 'setBreakpoints',
|
||||||
'arguments': {
|
'arguments': {
|
||||||
'source': {
|
'source': source,
|
||||||
'name': os.path.basename( file_name ),
|
|
||||||
'path': file_name,
|
|
||||||
},
|
|
||||||
'breakpoints': breakpoints,
|
'breakpoints': breakpoints,
|
||||||
'lines': [ line for line in line_breakpoints.keys() ],
|
'lines': [ line for line in line_breakpoints.keys() ],
|
||||||
'sourceModified': False,
|
'sourceModified': False,
|
||||||
|
|
@ -239,7 +241,7 @@ class DebugSession( object ):
|
||||||
)
|
)
|
||||||
|
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
self._UpdateBreakpoints,
|
functools.partial( self._UpdateBreakpoints, None ),
|
||||||
{
|
{
|
||||||
'command': 'setFunctionBreakpoints',
|
'command': 'setFunctionBreakpoints',
|
||||||
'arguments': {
|
'arguments': {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue