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
|
self._breakpoints_handler = handler
|
||||||
|
|
||||||
|
|
||||||
def SendBreakpoints( self ):
|
def SendBreakpoints( self, doneHandler = None ):
|
||||||
assert self._breakpoints_handler is not None
|
assert self._breakpoints_handler is not None
|
||||||
|
|
||||||
# Clear any existing breakpoints prior to sending new ones
|
# Clear any existing breakpoints prior to sending new ones
|
||||||
self._breakpoints_handler.ClearBreakpoints()
|
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():
|
for file_name, line_breakpoints in self._line_breakpoints.items():
|
||||||
breakpoints = []
|
breakpoints = []
|
||||||
for bp in line_breakpoints:
|
for bp in line_breakpoints:
|
||||||
|
|
@ -211,8 +221,9 @@ class ProjectBreakpoints( object ):
|
||||||
'path': file_name,
|
'path': file_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
awaiting = awaiting + 1
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
lambda msg: self._breakpoints_handler.AddBreakpoints( source, msg ),
|
lambda msg: response_handler( source, msg ),
|
||||||
{
|
{
|
||||||
'command': 'setBreakpoints',
|
'command': 'setBreakpoints',
|
||||||
'arguments': {
|
'arguments': {
|
||||||
|
|
@ -224,8 +235,9 @@ class ProjectBreakpoints( object ):
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._server_capabilities.get( 'supportsFunctionBreakpoints' ):
|
if self._server_capabilities.get( 'supportsFunctionBreakpoints' ):
|
||||||
|
awaiting = awaiting + 1
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
lambda msg: self._breakpoints_handler.AddBreakpoints( None, msg ),
|
lambda msg: response_handler( None, msg ),
|
||||||
{
|
{
|
||||||
'command': 'setFunctionBreakpoints',
|
'command': 'setFunctionBreakpoints',
|
||||||
'arguments': {
|
'arguments': {
|
||||||
|
|
@ -241,14 +253,18 @@ class ProjectBreakpoints( object ):
|
||||||
self._SetUpExceptionBreakpoints()
|
self._SetUpExceptionBreakpoints()
|
||||||
|
|
||||||
if self._exceptionBreakpoints:
|
if self._exceptionBreakpoints:
|
||||||
|
awaiting = awaiting + 1
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
None, # There is nothing on the response to this
|
lambda msg: response_handler( None, None ),
|
||||||
{
|
{
|
||||||
'command': 'setExceptionBreakpoints',
|
'command': 'setExceptionBreakpoints',
|
||||||
'arguments': self._exceptionBreakpoints
|
'arguments': self._exceptionBreakpoints
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if awaiting == 0 and doneHandler:
|
||||||
|
doneHandler()
|
||||||
|
|
||||||
|
|
||||||
def _SetUpExceptionBreakpoints( self ):
|
def _SetUpExceptionBreakpoints( self ):
|
||||||
exceptionBreakpointFilters = self._server_capabilities.get(
|
exceptionBreakpointFilters = self._server_capabilities.get(
|
||||||
|
|
|
||||||
|
|
@ -683,9 +683,7 @@ class DebugSession( object ):
|
||||||
|
|
||||||
|
|
||||||
def OnEvent_initialized( self, message ):
|
def OnEvent_initialized( self, message ):
|
||||||
self._codeView.ClearBreakpoints()
|
def onBreakpointsDone():
|
||||||
self._breakpoints.SendBreakpoints()
|
|
||||||
|
|
||||||
if self._server_capabilities.get( 'supportsConfigurationDoneRequest' ):
|
if self._server_capabilities.get( 'supportsConfigurationDoneRequest' ):
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
lambda msg: self._OnInitializeComplete(),
|
lambda msg: self._OnInitializeComplete(),
|
||||||
|
|
@ -696,6 +694,9 @@ class DebugSession( object ):
|
||||||
else:
|
else:
|
||||||
self._OnInitializeComplete()
|
self._OnInitializeComplete()
|
||||||
|
|
||||||
|
self._codeView.ClearBreakpoints()
|
||||||
|
self._breakpoints.SendBreakpoints( onBreakpointsDone )
|
||||||
|
|
||||||
def OnEvent_thread( self, message ):
|
def OnEvent_thread( self, message ):
|
||||||
self._stackTraceView.OnThreadEvent( message[ 'body' ] )
|
self._stackTraceView.OnThreadEvent( message[ 'body' ] )
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue