Skip to content

Commit

Permalink
Allow variables to reference other variables in other layers
Browse files Browse the repository at this point in the history
  • Loading branch information
puremourning committed Jul 25, 2019
1 parent be55649 commit d8d22b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions python3/vimspector/debug_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ def Start( self, launch_variables = {} ):
'gadgetDir': install.GetGadgetDir( VIMSPECTOR_HOME, install.GetOS() )
}
self._variables.update(
utils.ParseVariables( adapter.get( 'variables', {} ) ) )
utils.ParseVariables( adapter.get( 'variables', {} ),
self._variables ) )
self._variables.update(
utils.ParseVariables( configuration.get( 'variables', {} ) ) )
utils.ParseVariables( configuration.get( 'variables', {} ),
self._variables ) )
self._variables.update( launch_variables )

utils.ExpandReferencesInDict( configuration, self._variables )
Expand Down
4 changes: 2 additions & 2 deletions python3/vimspector/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def expand_refs_in_object( obj ):
obj[ k ] = expand_refs_in_object( obj[ k ] )


def ParseVariables( variables ):
def ParseVariables( variables, mapping, **kwargs ):
new_variables = {}
for n, v in variables.items():
if isinstance( v, dict ):
Expand All @@ -353,7 +353,7 @@ def ParseVariables( variables ):

new_v = v.copy()
# Bit of a hack. Allows environment variables to be used.
ExpandReferencesInDict( new_v, {} )
ExpandReferencesInDict( new_v, mapping, **kwargs )

env = os.environ.copy()
env.update( new_v.get( 'env' ) or {} )
Expand Down

0 comments on commit d8d22b1

Please sign in to comment.