Alow env and cwd to be specified for the _adapter_

This commit is contained in:
Ben Jackson 2019-02-01 10:05:16 +00:00
commit f1859639d7
2 changed files with 11 additions and 0 deletions

View file

@ -76,6 +76,8 @@ function! vimspector#internal#job#StartDebugSession( config ) abort
\ 'out_cb': funcref( 's:_OnServerData' ), \ 'out_cb': funcref( 's:_OnServerData' ),
\ 'err_cb': funcref( 's:_OnServerError' ), \ 'err_cb': funcref( 's:_OnServerError' ),
\ 'stoponexit': 'term', \ 'stoponexit': 'term',
\ 'env': a:config[ 'env' ],
\ 'cwd': a:config[ 'cwd' ],
\ } \ }
\ ) \ )

View file

@ -368,6 +368,15 @@ class DebugSession( object ):
port = utils.AskForInput( 'Enter port to connect to: ' ) port = utils.AskForInput( 'Enter port to connect to: ' )
self._adapter[ 'port' ] = port self._adapter[ 'port' ] = port
# TODO: Do we actually need to copy and update or does Vim do that?
env = os.environ.copy()
if 'env' in self._adapter:
env.update( self._adapter[ 'env' ] )
self._adapter[ 'env' ] = env
if 'cwd' not in self._adapter:
self._adapter[ 'cwd' ] = os.getcwd()
channel_send_func = vim.bindeval( channel_send_func = vim.bindeval(
"vimspector#internal#{}#StartDebugSession( {} )".format( "vimspector#internal#{}#StartDebugSession( {} )".format(
self._connection_type, self._connection_type,