VScode lanuch.json 预定变量
Variable substitution#
VS Code supports variable substitution inside strings in launch.json and has the following predefined variables:
- ${workspaceRoot} - the path of the folder opened in VS Code
- ${workspaceRootFolderName} - the name of the folder opened in VS Code without any slashes (/)
- ${file} - the current opened file
- ${relativeFile} - the current opened file relative to
workspaceRoot - ${fileBasename} - the current opened file's basename
- ${fileBasenameNoExtension} - the current opened file's basename with no file extension
- ${fileDirname} - the current opened file's dirname
- ${fileExtname} - the current opened file's extension
- ${cwd} - the task runner's current working directory on startup
- ${lineNumber} - the current selected line number in the active file
You can also reference environment variables through ${env:Name} syntax (for example, ${env:PATH}). Be sure to match the environment variable name's casing, for example ${env:Path} on Windows.
{ "type": "node", "request": "launch", "name": "Launch Program", "program": "${workspaceRoot}/app.js", "cwd": "${workspaceRoot}", "args": [ "${env:USERNAME}" ] }
You can reference VS Code settings and commands using the following syntax:
- ${config:Name} - example:
${config:editor.fontSize} - ${command:CommandID} - example:
${command:explorer.newFolder}

浙公网安备 33010602011771号