I'm using a VSCode multi-root workspace. I want to define some tasks in myprojects.code-workspace
using a variable for the root directory.
In a regular .vscode/tasks.json
I could use ${workspaceFolder}
.
However when I create this simple task in .project.code-workspace
:
{"label": "foo","type": "shell","command": "echo ${workspaceFolder}"}
...it prints the first workspace path:
/home/username/myprojects/project1
instead of:
/home/username/myprojects
So the ${workspaceFolder}
variable is obviously unsuitable.
Is there a variable that refers to the multiroot workspace's root?
UPDATE
To address the "why do you want that" query. It's a very common developer setup: similar to a monorepo as all projects are open simultaneously (for convenience), but not really a monorepo:
myprojects/ # multi-root workspace's root .code-workspace # has tasks which target all projects (so needs multiroot's root directory) project1/ .git/ src/ project2/ .git/ src/ project3/ .git/ src/