Allow mappings to specify variables
This commit is contained in:
parent
f210d5d150
commit
1905556edd
2 changed files with 16 additions and 15 deletions
|
|
@ -22,11 +22,14 @@ set cpo&vim
|
||||||
|
|
||||||
call vimspector#internal#state#Reset()
|
call vimspector#internal#state#Reset()
|
||||||
|
|
||||||
" TODO: Test function
|
|
||||||
function! vimspector#Launch() abort
|
function! vimspector#Launch() abort
|
||||||
py3 _vimspector_session.Start()
|
py3 _vimspector_session.Start()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#LaunchWithSettings( settings ) abort
|
||||||
|
py3 _vimspector_session.Start( launch_variables = vim.eval( 'a:settings' ) )
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! vimspector#Reset() abort
|
function! vimspector#Reset() abort
|
||||||
py3 _vimspector_session.Reset()
|
py3 _vimspector_session.Reset()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ class DebugSession( object ):
|
||||||
# have a UI list of them we should update that at this point
|
# have a UI list of them we should update that at this point
|
||||||
self._UpdateUIBreakpoints()
|
self._UpdateUIBreakpoints()
|
||||||
|
|
||||||
def Start( self, configuration = None ):
|
def Start( self, launch_variables = {} ):
|
||||||
self._configuration = None
|
self._configuration = None
|
||||||
self._adapter = None
|
self._adapter = None
|
||||||
|
|
||||||
|
|
@ -123,29 +123,27 @@ class DebugSession( object ):
|
||||||
launch_config = database.get( 'configurations' )
|
launch_config = database.get( 'configurations' )
|
||||||
adapters = database.get( 'adapters' )
|
adapters = database.get( 'adapters' )
|
||||||
|
|
||||||
if not configuration:
|
if len( launch_config ) == 1:
|
||||||
if len( launch_config ) == 1:
|
configuration = next( iter( launch_config.keys() ) )
|
||||||
configuration = next( iter( launch_config.keys() ) )
|
else:
|
||||||
else:
|
configuration = utils.SelectFromList( 'Which launch configuration?',
|
||||||
configuration = utils.SelectFromList( 'Which launch configuration?',
|
list( launch_config.keys() ) )
|
||||||
list( launch_config.keys() ) )
|
|
||||||
|
|
||||||
if not configuration:
|
if not configuration:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._workspace_root = os.path.dirname( launch_config_file )
|
self._workspace_root = os.path.dirname( launch_config_file )
|
||||||
|
|
||||||
utils.ExpandReferencesInDict( launch_config[ configuration ], {
|
variables = {
|
||||||
|
'dollar': '$', # HAAACK: work around not having a way to include a literal
|
||||||
'workspaceRoot': self._workspace_root
|
'workspaceRoot': self._workspace_root
|
||||||
} )
|
}
|
||||||
|
variables.update( launch_variables )
|
||||||
|
utils.ExpandReferencesInDict( launch_config[ configuration ], variables )
|
||||||
|
|
||||||
adapter = launch_config[ configuration ].get( 'adapter' )
|
adapter = launch_config[ configuration ].get( 'adapter' )
|
||||||
if isinstance( adapter, str ):
|
if isinstance( adapter, str ):
|
||||||
adapter = adapters.get( adapter )
|
adapter = adapters.get( adapter )
|
||||||
utils.ExpandReferencesInDict( adapter, {
|
utils.ExpandReferencesInDict( adapter, variables )
|
||||||
'workspaceRoot': os.path.dirname( launch_config_file )
|
|
||||||
} )
|
|
||||||
|
|
||||||
|
|
||||||
self._StartWithConfiguration( launch_config[ configuration ],
|
self._StartWithConfiguration( launch_config[ configuration ],
|
||||||
adapter )
|
adapter )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue