Allow pausing individual threads (in theory)
This commit is contained in:
parent
a5d66a7477
commit
f0785c11f2
3 changed files with 41 additions and 1 deletions
|
|
@ -171,6 +171,13 @@ function! vimspector#Pause() abort
|
||||||
py3 _vimspector_session.Pause()
|
py3 _vimspector_session.Pause()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#PauseThread() abort
|
||||||
|
if !s:Enabled()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
py3 _vimspector_session.PauseThread()
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! vimspector#Stop() abort
|
function! vimspector#Stop() abort
|
||||||
if !s:Enabled()
|
if !s:Enabled()
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -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()
|
@IfConnected()
|
||||||
def ExpandVariable( self ):
|
def ExpandVariable( self ):
|
||||||
self._variablesView.ExpandVariable()
|
self._variablesView.ExpandVariable()
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,13 @@ class StackTraceView( object ):
|
||||||
vim.command( 'nnoremap <silent> <buffer> <2-LeftMouse> '
|
vim.command( 'nnoremap <silent> <buffer> <2-LeftMouse> '
|
||||||
':<C-U>call vimspector#GoToFrame()<CR>' )
|
':<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_frame = {}
|
||||||
self._line_to_thread = {}
|
self._line_to_thread = {}
|
||||||
|
|
||||||
|
|
@ -264,10 +271,22 @@ class StackTraceView( object ):
|
||||||
self._connection.DoRequest( consume_stacktrace, {
|
self._connection.DoRequest( consume_stacktrace, {
|
||||||
'command': 'stackTrace',
|
'command': 'stackTrace',
|
||||||
'arguments': {
|
'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 ):
|
def ExpandFrameOrThread( self ):
|
||||||
if vim.current.buffer != self._buf:
|
if vim.current.buffer != self._buf:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue