Skip to content

Commit

Permalink
Only load threads after _both_ init and launch. Maybe this is the mag…
Browse files Browse the repository at this point in the history
…ic that works for all servers
  • Loading branch information
puremourning committed Feb 4, 2019
1 parent 463f7a8 commit 85d2f10
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions python3/vimspector/debug_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def __init__( self ):
self._configuration = None

self._attach_process = None
self._init_complete = False
self._launch_complete = False

vim.command( 'sign define vimspectorBP text==> texthl=Error' )
vim.command( 'sign define vimspectorBPDisabled text=!> texthl=Warning' )
Expand Down Expand Up @@ -229,6 +231,9 @@ def _Reset( self ):
json.dumps( self._attach_process ) ) )
self._attach_process = None

self._init_complete = False
self._launch_complete = False

if self._uiTab:
self._stackTraceView.Reset()
self._variablesView.Reset()
Expand Down Expand Up @@ -381,6 +386,9 @@ def _StartDebugAdapter( self ):
self._logger.info( 'Starting debug adapter with: {0}'.format( json.dumps(
self._adapter ) ) )

self._init_complete = False
self._launch_complete = False

self._connection_type = 'job'
if 'port' in self._adapter:
self._connection_type = 'channel'
Expand Down Expand Up @@ -572,7 +580,7 @@ def _Launch( self ):
# then starts to listen for thread events to detect new or terminated
# threads.
#
lambda msg: self._stackTraceView.LoadThreads( True ),
lambda msg: self._OnLaunchComplete(),
{
'command': launch_config[ 'request' ],
'arguments': launch_config
Expand All @@ -586,11 +594,22 @@ def _UpdateBreakpoints( self, source, message ):
self._codeView.AddBreakpoints( source, message[ 'body' ][ 'breakpoints' ] )
self._codeView.ShowBreakpoints()

def _OnLaunchComplete( self ):
self._launch_complete = True
self._LoadThreadsIfReady()

def _OnInitializeComplete( self ):
self._init_complete = True
self._LoadThreadsIfReady()

def _LoadThreadsIfReady( self ):
if self._launch_complete and self._init_complete:
self._stackTraceView.LoadThreads( True )

def OnEvent_initialized( self, message ):
self._SendBreakpoints()
self._connection.DoRequest(
None,
self._OnInitializeComplete(),
{
'command': 'configurationDone',
}
Expand Down

0 comments on commit 85d2f10

Please sign in to comment.