You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Substitute variables in launch configuration keys (and not only in values) #34059
debugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionalityrelease-notesRelease notes issuesverifiedVerification succeeded
Feature description:
It would be nice to use the environment variable $ {env: variable} in launch.json sourceFileMap, like using the built-in variable $ {workspaceRoot}.
The present situation is that we can write $ {env: variable} in sourceFileMap, but it is not replaced by real path like $ {workspaceRoot}.
So, when debugging with cpptools extension for c++ program,vscode pops up the following message box:
Error: Unable to open 'main.cpp': File not found (\usr1\pDTest\demo\main.cpp). Create File Cancel
The sourceFileMap is very simple:
"sourceFileMap": {
// "remote": "local"
// This way works well
// "/usr1/pDTest/demo" : "D:\\demo"
// This way does not work
"/usr1/{env:USERNAME}/demo" : "D:\\demo"
},
This feature is useful for collaborative development of multiple programmers. we can push launch.json on git repo, and do not need everyone to modify it.
changed the title [-]Feature require: sourceFileMap support environment variable like ${workspaceRoot}[/-][+]Substitute variables in launch configuration keys (and not only in values)[/+]on Sep 29, 2017
Isidor Nikolic (@isidorn) since VS Code's use of JSONs sometimes has values on the left hand side (as keys), we should consequently support variable substitution there too (and I've targeted this for "On Deck").
debugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionalityrelease-notesRelease notes issuesverifiedVerification succeeded
Activity
isidorn commentedon Sep 12, 2017
Yes, currently we are only resolving the values of objects in the configuration, not the keys (which is what you want).
We accept PRs that elegantly fix this, code pointer https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/services/configurationResolver/node/configurationResolverService.ts#L194
[-]Feature require: sourceFileMap support environment variable like ${workspaceRoot}[/-][+]Substitute variables in launch configuration keys (and not only in values)[/+]OkkeHendriks commentedon Nov 1, 2017
nbstar I was wondering if you have found a workaround for this?
weinand commentedon Nov 14, 2017
Isidor Nikolic (@isidorn) since VS Code's use of JSONs sometimes has values on the left hand side (as keys), we should consequently support variable substitution there too (and I've targeted this for "On Deck").
I assume this feature is low-hanging fruit?
isidorn commentedon Nov 14, 2017
Andre Weinand (@weinand) should not be too complex
isidorn commentedon May 11, 2018
Dirk Bäumer (@dbaeumer) note that we now also resolve keys not only values in configuraitons since this also affects tasks.
aeschli commentedon May 31, 2018
Verified that variables are substituted in both values and keys: