Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve project detection #47

Open
sfsaccone opened this issue Jul 20, 2020 · 4 comments
Open

Improve project detection #47

sfsaccone opened this issue Jul 20, 2020 · 4 comments
Labels

Comments

@sfsaccone
Copy link

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

@fabiospampinato
Copy link
Owner

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.

@sfsaccone
Copy link
Author

Yup, that sounds right. The error seems to occur if and only if the current editor is a file outside the workspace folder. Thanks!

@fabiospampinato fabiospampinato changed the title "No terminals defined" error unless terminals.json is open in the editor Improve project detection Apr 2, 2021
@ben-page
Copy link

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.

@ThayalanGR
Copy link

ThayalanGR commented Jul 4, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants