Allow pausing individual threads (in theory)

This commit is contained in:
Ben Jackson 2020-11-20 23:18:20 +00:00
commit f0785c11f2
3 changed files with 41 additions and 1 deletions

View file

@ -491,6 +491,20 @@ class DebugSession( object ):
},
} )
@IfConnected()
def PauseThread( self ):
threadId = self._stackTraceView.GetSelectedThreadId()
if threadId is None:
utils.UserMessage( 'No thread selected' )
return
self._connection.DoRequest( None, {
'command': 'pause',
'arguments': {
'threadId': threadId,
},
} )
@IfConnected()
def ExpandVariable( self ):
self._variablesView.ExpandVariable()

View file

@ -109,6 +109,13 @@ class StackTraceView( object ):
vim.command( 'nnoremap <silent> <buffer> <2-LeftMouse> '
':<C-U>call vimspector#GoToFrame()<CR>' )
if utils.UseWinBar():
vim.command( 'nnoremenu 1.2 WinBar.Open '
':call vimspector#GoToFrame()<CR>' )
vim.command( 'nnoremenu 1.1 WinBar.Pause '
':call vimspector#PauseThread()<CR>' )
self._line_to_frame = {}
self._line_to_thread = {}
@ -264,10 +271,22 @@ class StackTraceView( object ):
self._connection.DoRequest( consume_stacktrace, {
'command': 'stackTrace',
'arguments': {
'threadId': thread.thread[ 'id' ],
'threadId': thread.id,
}
} )
def GetSelectedThreadId( self ):
if vim.current.buffer != self._buf:
return None
thread = self._line_to_thread.get( vim.current.window.cursor[ 0 ] )
if not thread:
return None
return thread.id
def ExpandFrameOrThread( self ):
if vim.current.buffer != self._buf:
return