Allow for variable expansion in configuration

We expand environment variables, ~ and workspaceRoot. The latter is to
match vscode and typical launch configs. As we don't know what the
workspeace root might be, we use the location of the .vimspector.json.
This commit is contained in:
Ben Jackson 2018-06-10 23:31:20 +01:00
commit 79b25c0860
2 changed files with 32 additions and 0 deletions

View file

@ -133,9 +133,17 @@ class DebugSession( object ):
if not configuration:
return
utils.ExpandReferencesInDict( launch_config[ configuration ], {
'workspaceRoot': os.path.dirname( launch_config_file )
} )
adapter = launch_config[ configuration ].get( 'adapter' )
if isinstance( adapter, str ):
adapter = adapters.get( adapter )
utils.ExpandReferencesInDict( adapter, {
'workspaceRoot': os.path.dirname( launch_config_file )
} )
self._StartWithConfiguration( launch_config[ configuration ],
adapter )
@ -144,6 +152,11 @@ class DebugSession( object ):
self._configuration = configuration
self._adapter = adapter
self._logger.info( 'Configuration: {0}'.format( json.dumps(
self._configuration ) ) )
self._logger.info( 'Adapter: {0}'.format( json.dumps(
self._adapter ) ) )
def start():
self._StartDebugAdapter()
self._Initialise()