Support runInTerminal (sort of)
This commit is contained in:
parent
689b006b6f
commit
62e9335a10
3 changed files with 43 additions and 0 deletions
|
|
@ -165,3 +165,33 @@ class CodeView( object ):
|
|||
'vimspectorBP' if breakpoint[ 'verified' ]
|
||||
else 'vimspectorBPDisabled',
|
||||
file_name ) )
|
||||
|
||||
|
||||
def LaunchTerminal( self, params ):
|
||||
# kind = params.get( 'kind', 'integrated' )
|
||||
|
||||
# FIXME: We don't support external terminals, and only open in the
|
||||
# integrated one.
|
||||
|
||||
cwd = params[ 'cwd' ]
|
||||
args = params[ 'args' ]
|
||||
env = params.get( 'env', {} )
|
||||
|
||||
options = {
|
||||
'vertical': 1,
|
||||
'norestore': 1,
|
||||
'cwd': cwd,
|
||||
'env': env,
|
||||
}
|
||||
|
||||
with utils.TemporaryVimOptions( { 'splitright': True,
|
||||
'equalalways': False } ):
|
||||
with utils.RestoreCurrentWindow():
|
||||
vim.current.window = self._window
|
||||
# TODO/FIXME: Do something about closing this when we reset ?
|
||||
vim_cmd = 'term_start( {}, {} )'.format( json.dumps( args ),
|
||||
json.dumps( options ) )
|
||||
|
||||
self._logger.debug( 'Start terminal: {}'.format( vim_cmd ) )
|
||||
|
||||
vim.eval( vim_cmd )
|
||||
|
|
|
|||
|
|
@ -166,3 +166,11 @@ class DebugAdapterConnection( object ):
|
|||
else:
|
||||
utils.UserMessage( 'Unhandled event: {0}'.format( message[ 'event' ] ),
|
||||
persist = True )
|
||||
elif message[ 'type' ] == 'request':
|
||||
method = 'OnRequest_' + message[ 'command' ]
|
||||
if method in dir( self._handler ):
|
||||
getattr( self._handler, method )( message )
|
||||
else:
|
||||
utils.UserMessage(
|
||||
'Unhandled request: {0}'.format( message[ 'command' ] ),
|
||||
persist = True )
|
||||
|
|
|
|||
|
|
@ -481,6 +481,11 @@ class DebugSession( object ):
|
|||
'Unrecognised breakpoint event (undocumented): {0}'.format( reason ),
|
||||
persist = True )
|
||||
|
||||
def OnRequest_runInTerminal( self, message ):
|
||||
params = message[ 'arguments' ]
|
||||
|
||||
self._codeView.LaunchTerminal( params )
|
||||
|
||||
def Clear( self ):
|
||||
self._codeView.Clear()
|
||||
self._stackTraceView.Clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue