Fix breakpoints
This commit is contained in:
parent
14f6814ff1
commit
8528d80510
2 changed files with 30 additions and 12 deletions
|
|
@ -16,7 +16,7 @@
|
|||
from collections import defaultdict
|
||||
|
||||
import vim
|
||||
import functools
|
||||
import os
|
||||
|
||||
|
||||
class ProjectBreakpoints( object ):
|
||||
|
|
@ -27,6 +27,9 @@ class ProjectBreakpoints( object ):
|
|||
self._line_breakpoints = defaultdict( list )
|
||||
self._func_breakpoints = []
|
||||
|
||||
# FIXME: Remove this. Remove breakpoints nonesense from code.py
|
||||
self._breakpoints_handler = None
|
||||
|
||||
self._next_sign_id = 1
|
||||
|
||||
# TODO: Change to sign_define ?
|
||||
|
|
@ -127,7 +130,17 @@ class ProjectBreakpoints( object ):
|
|||
else:
|
||||
self._ShowBreakpoints()
|
||||
|
||||
def SendBreakpoints( self, handler ):
|
||||
|
||||
# FIXME: Remove this temporary compat .layer
|
||||
def SetBreakpointsHandler( self, handler ):
|
||||
self._breakpoints_handler = handler
|
||||
|
||||
def SendBreakpoints( self ):
|
||||
if not self._breakpoints_handler:
|
||||
handler = lambda source, msg: self._ShowBreakpoints()
|
||||
else:
|
||||
handler = self._breakpoints_handler
|
||||
|
||||
for file_name, line_breakpoints in self._line_breakpoints.items():
|
||||
breakpoints = []
|
||||
for bp in line_breakpoints:
|
||||
|
|
@ -147,7 +160,7 @@ class ProjectBreakpoints( object ):
|
|||
}
|
||||
|
||||
self._connection.DoRequest(
|
||||
functools.partial( self._UpdateBreakpoints, source ),
|
||||
lambda msg: handler( source, msg ),
|
||||
{
|
||||
'command': 'setBreakpoints',
|
||||
'arguments': {
|
||||
|
|
@ -159,7 +172,7 @@ class ProjectBreakpoints( object ):
|
|||
)
|
||||
|
||||
self._connection.DoRequest(
|
||||
functools.partial( self._UpdateBreakpoints, None ),
|
||||
lambda msg: handler( None, msg ),
|
||||
{
|
||||
'command': 'setFunctionBreakpoints',
|
||||
'arguments': {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,16 @@ class DebugSession( object ):
|
|||
self._stackTraceView.ConnectionUp( self._connection )
|
||||
self._variablesView.ConnectionUp( self._connection )
|
||||
self._outputView.ConnectionUp( self._connection )
|
||||
self._breakpoints.ConnectionUp( self._connection )
|
||||
|
||||
def update_breakpoints( source, message ):
|
||||
if 'body' not in message:
|
||||
return
|
||||
self._codeView.AddBreakpoints( source,
|
||||
message[ 'body' ][ 'breakpoints' ] )
|
||||
self._codeView.ShowBreakpoints()
|
||||
|
||||
self._breakpoints.SetBreakpointsHandler( update_breakpoints )
|
||||
|
||||
if self._connection:
|
||||
self._StopDebugAdapter( start )
|
||||
|
|
@ -539,15 +549,8 @@ class DebugSession( object ):
|
|||
self._stackTraceView.LoadThreads( True )
|
||||
|
||||
def OnEvent_initialized( self, message ):
|
||||
def update_breakpoints( source, message ):
|
||||
if 'body' not in message:
|
||||
return
|
||||
self._codeView.AddBreakpoints( source,
|
||||
message[ 'body' ][ 'breakpoints' ] )
|
||||
self._codeView.ShowBreakpoints()
|
||||
|
||||
self._codeView.ClearBreakpoints()
|
||||
self._breakpoints.SendBreakpoints( update_breakpoints )
|
||||
self._breakpoints.SendBreakpoints()
|
||||
|
||||
self._connection.DoRequest(
|
||||
lambda msg: self._OnInitializeComplete(),
|
||||
|
|
@ -614,6 +617,8 @@ class DebugSession( object ):
|
|||
self._stackTraceView.ConnectionClosed()
|
||||
self._variablesView.ConnectionClosed()
|
||||
self._outputView.ConnectionClosed()
|
||||
self._breakpoints.ConnectionClosed()
|
||||
self._breakpoints.SetBreakpointsHandler( None )
|
||||
|
||||
self._ResetServerState()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue