Open sfsaccone opened 3 years ago
I think the issue is that the current active project is inferred depending on what file is currently active, so if you open the settings for example the whole thing falls apart.
Yup, that sounds right. The error seems to occur if and only if the current editor is a file outside the workspace folder. Thanks!
This is causing me problems as well. I can't reliably use relative paths in the cwd
in a workspace with multiple folders, since they are always relative to the folder of the open file.
I expected to be able to use [workspaceFolder]
to work around this. But it's not pointing to the workspace folder (the folder containing the workspace file), but rather the root folder of the active file.
It probably too late to fix [workspaceFolder]
. But maybe another variable could be introduced that always points to the location of the workspace file. Alternatively, being able to specify the specific folder [folder:name]
would work as well.
@fabiospampinato any improvements on this thread? Commands which uses relative path fails on multiroot workspaces. Suggestion: commands should always run relative to the terminals.json / .code-workspace.json file irrespective of where the recently opened folders / files (in case of multiroot workspace).
I was trying to find a workaround for this issue by consuming [workSpaceFolder] and accumlating the relative directory as said by @ben-page like this
{
"name": "Git pull origin main",
"commands": [
"rootDir=$(echo [workspaceFolder] | sed s/cv-workspaces\\\\/cv-frontend//g)",
"echo $rootDir",
"git -C $rootDir/cv-workspaces pull origin main",
"git -C $rootDir/fluid-ui pull origin main",
"git -C $rootDir/creators-studio pull origin main"
],
"onlySingle": true,
"open": true
}
Since [workSpaceFolder] is not static, it changes relative to the current editor bench focused files/directory, the above workaround fails
UPDATE: Here is the forked implementation, where the above mentioned issue has been resolved - Terminals Manager Pro , BTW sorry for re-implementation, it seems like there is no activity in this project recently, so I forked and published my own version of terminals manager instead raising PR for this fix.
Problem
Often when I run "Terminals:Run" I get the error "No terminals defined, edit the configuration". Unfortunately, I can't consistently reproduce this. The workaround below can persist after restart.
Workaround
Open the configuration file (
code .vscode/terminals.json
in Linux) then run "Terminals: Run" while the file is open in the editor. Then it works. And, sometimes at least, it continues to work after I restart VS Code.Environment
VS Code: 1.47.2 running on Windows 10 Remote OS: Ubuntu Server 20.04 Terminals Manager: 1.12.9