I have seen how launch.json
for Visual Studio Code has access to ${workspaceFolder}
. Does it also have access to other common variables? I would like to have access to the current user's AppData folder so I can do:
"program": "${appData}\\Roaming\\npm\\node_modules\\gulp\\bin\\gulp.js"
instead of hard-coding it as:
"program": "C:\\Users\\jdoe\\AppData\\Roaming\\npm\\node_modules\\gulp\\bin\\gulp.js"
vscode folder in your workspace (project root folder) or in your user settings or workspace settings. To create a launch. json file, click the create a launch. json file link in the Run start view.
The launch. json file is located in a . vscode folder in your workspace (project root folder).
js Apps with Visual Studio Code. Click on Run and Debug in the Activity Bar (⇧⌘D (Windows, Linux Ctrl+Shift+D)) and then select the create a launch. json file link to create a default launch.
Variable substitution in launch.json supports environment variables. For your use-case you can use ${env:AppData}
.
VS Code supports variable substitution inside strings in
launch.json
the same way as fortasks.json
.
https://code.visualstudio.com/docs/editor/tasks#_variable-substitution
${workspaceFolder}
the path of the folder opened in VS Code${file}
the current opened file${relativeFile}
the current opened file relative to workspaceRoot${fileBasename}
the current opened file's basename${fileDirname}
the current opened file's dirname${fileExtname}
the current opened file's extension${cwd}
the task runner's current working directory on startupYou can also reference environment variables through
${env:Name}
(e.g.${env:PATH})
. Be sure to match the environment variable name's casing, for example env:Path on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With