Delay configurationDone until we have received _responses_ to the breakpoint requests, as go server seems to require this
This commit is contained in:
parent
adfce8d30e
commit
b6a2e3df9e
2 changed files with 32 additions and 15 deletions
|
|
@ -187,12 +187,22 @@ class ProjectBreakpoints( object ):
|
|||
self._breakpoints_handler = handler
|
||||
|
||||
|
||||
def SendBreakpoints( self ):
|
||||
def SendBreakpoints( self, doneHandler = None ):
|
||||
assert self._breakpoints_handler is not None
|
||||
|
||||
# Clear any existing breakpoints prior to sending new ones
|
||||
self._breakpoints_handler.ClearBreakpoints()
|
||||
|
||||
awaiting = 0
|
||||
def response_handler( source, msg ):
|
||||
if msg:
|
||||
self._breakpoints_handler.AddBreakpoints( source, msg )
|
||||
nonlocal awaiting
|
||||
awaiting = awaiting - 1
|
||||
if awaiting == 0 and doneHandler:
|
||||
doneHandler()
|
||||
|
||||
|
||||
for file_name, line_breakpoints in self._line_breakpoints.items():
|
||||
breakpoints = []
|
||||
for bp in line_breakpoints:
|
||||
|
|
@ -211,8 +221,9 @@ class ProjectBreakpoints( object ):
|
|||
'path': file_name,
|
||||
}
|
||||
|
||||
awaiting = awaiting + 1
|
||||
self._connection.DoRequest(
|
||||
lambda msg: self._breakpoints_handler.AddBreakpoints( source, msg ),
|
||||
lambda msg: response_handler( source, msg ),
|
||||
{
|
||||
'command': 'setBreakpoints',
|
||||
'arguments': {
|
||||
|
|
@ -224,8 +235,9 @@ class ProjectBreakpoints( object ):
|
|||
)
|
||||
|
||||
if self._server_capabilities.get( 'supportsFunctionBreakpoints' ):
|
||||
awaiting = awaiting + 1
|
||||
self._connection.DoRequest(
|
||||
lambda msg: self._breakpoints_handler.AddBreakpoints( None, msg ),
|
||||
lambda msg: response_handler( None, msg ),
|
||||
{
|
||||
'command': 'setFunctionBreakpoints',
|
||||
'arguments': {
|
||||
|
|
@ -241,14 +253,18 @@ class ProjectBreakpoints( object ):
|
|||
self._SetUpExceptionBreakpoints()
|
||||
|
||||
if self._exceptionBreakpoints:
|
||||
awaiting = awaiting + 1
|
||||
self._connection.DoRequest(
|
||||
None, # There is nothing on the response to this
|
||||
lambda msg: response_handler( None, None ),
|
||||
{
|
||||
'command': 'setExceptionBreakpoints',
|
||||
'arguments': self._exceptionBreakpoints
|
||||
}
|
||||
)
|
||||
|
||||
if awaiting == 0 and doneHandler:
|
||||
doneHandler()
|
||||
|
||||
|
||||
def _SetUpExceptionBreakpoints( self ):
|
||||
exceptionBreakpointFilters = self._server_capabilities.get(
|
||||
|
|
|
|||
|
|
@ -683,18 +683,19 @@ class DebugSession( object ):
|
|||
|
||||
|
||||
def OnEvent_initialized( self, message ):
|
||||
self._codeView.ClearBreakpoints()
|
||||
self._breakpoints.SendBreakpoints()
|
||||
def onBreakpointsDone():
|
||||
if self._server_capabilities.get( 'supportsConfigurationDoneRequest' ):
|
||||
self._connection.DoRequest(
|
||||
lambda msg: self._OnInitializeComplete(),
|
||||
{
|
||||
'command': 'configurationDone',
|
||||
}
|
||||
)
|
||||
else:
|
||||
self._OnInitializeComplete()
|
||||
|
||||
if self._server_capabilities.get( 'supportsConfigurationDoneRequest' ):
|
||||
self._connection.DoRequest(
|
||||
lambda msg: self._OnInitializeComplete(),
|
||||
{
|
||||
'command': 'configurationDone',
|
||||
}
|
||||
)
|
||||
else:
|
||||
self._OnInitializeComplete()
|
||||
self._codeView.ClearBreakpoints()
|
||||
self._breakpoints.SendBreakpoints( onBreakpointsDone )
|
||||
|
||||
def OnEvent_thread( self, message ):
|
||||
self._stackTraceView.OnThreadEvent( message[ 'body' ] )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue