Are there variables for the current file or folder in the VS Code terminal?
2 answers
Not sure if this is exactly what you are looking for, but you can access various variables in your code, for example:
${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
+2
source to share
They have added a few new variables and contain ${fileDirname}
which is the path to the directory your current is in ${file}
. The documentation seems to be a little misleading.
These are the currently available options:
${workspaceFolder} - the path of the folder opened in VS Code
${workspaceFolderBasename} - the name of the folder opened in VS Code without any slashes (/)
${file} - the current opened file
${relativeFile} - the current opened file relative to workspaceFolder
${fileBasename} - the current opened file basename
${fileBasenameNoExtension} - the current opened file basename with no file extension
${fileDirname} - the current opened file dirname
${fileExtname} - the current opened file extension
${cwd} - the task runner current working directory on startup
${lineNumber} - the current selected line number in the active file
0
source to share