fabiospampinato / vscode-terminals

An extension for setting-up multiple terminals at once, or just running some commands.
MIT License
121 stars 20 forks source link

Doesn't work with multiple repos in workspace #33

Closed sbungert-mms closed 3 years ago

sbungert-mms commented 5 years ago

If you have multiple repos, the last opened terminal's working directory is used to look for terminals.json.

If the last opened terminal was for a repo/folder that doesn't have a terminals file an error is displayed saying there is no terminals file. You have to then open a terminal for the repo with the terminals json in order for the run terminals command to work.

I think terminals manager should check all root level repo folders in the workspace for a file and run that or ask which repo should be used to run the "terminals run" command.

I want to have one file where I define the terminals for all repo folders in my workspace, not a separate one for each repo.

Alternatively use the currently selected source control provider that you see in the Source Control sidebar. Then I could just switch to the one with the terminals json file and start the "run terminals" command

fabiospampinato commented 5 years ago

Can you publish a simple repo that reproduces the issue? As far as I remember I actually wanted the extension to work the way you're describing, but maybe something is not working correctly 🤔

sbungert-mms commented 4 years ago

--deleted--

sbungert-mms commented 4 years ago

I'm not sure if I can make a repo. as it is about a workspace. I can try and make several small demo repos which can then be added to a workspace

sketchbuch commented 4 years ago

Do you maybe check just the rootfolder of the active text editor when looking for a terminals file? Once this starts happening to me I have to close VSC with a file from the root folder with the terminals config open otherwise I keep seeing this error upon restart.

sketchbuch commented 4 years ago

If you create a workspace and add three folders (all repos) and then add a terminal config to just one of them (not set to auto start) and select a file in a repo without a terminals file and then run "terminals run" you get the message that no terminal files are found.

If you then open a file in the repo where the terminals file is defined and run "Temrinals run" the terminals will spawn as expected.

I think you are looking for the active editor and just checking the active editor's folder in the workspace for a terminals file... I think if this fails and there are additional folders in the WS these should also be checked and if a terminals file is found it is run.

fabiospampinato commented 4 years ago

I think you are looking for the active editor and just checking the active editor's folder in the workspace for a terminals file... I think if this fails and there are additional folders in the WS these should also be checked and if a terminals file is found it is run.

Our folder detection logic isn't great, I stumble upon this across my extensions constantly when dealing with an untitled document. There's definitely some obvious room for improvement in single-folder-workspace scenarios, but in multi-folder-workspace scenarios I'm not sure what you're suggesting is really better 🤔 Could you tell me a little more about your specific scenario?

arvenil commented 4 years ago

I have 3 folders in a workspace

test-workspace.code-workspace
a
b
c
{
    "folders": [
        {
            "path": "a"
        },
        {
            "path": "b"
        },
        {
            "path": "c"
        }
    ]
}

I want to run one terminal per directory/project I have in workspace so I've saved this configuration:

{
    "terminals.autorun": true,
    "terminals.showCommands": true,
    "terminals.terminals": [
        {
            "name":"a",
            "cwd":"a",
        },
        {
            "name":"b",
            "cwd":"b",
        },
        {
            "name":"c",
            "cwd":"c",
        },
    ]
}

I've also tried to prepend cwd with [workspaceFolder] but both result with 3 popup errors

The provided cwd path doesn't exist: "/Users/nil/test-workspace/c/a"
The provided cwd path doesn't exist: "/Users/nil/test-workspace/c/b"
The provided cwd path doesn't exist: "/Users/nil/test-workspace/c/c"

I've also tried to use per directory terminals.json, and this works better:

Users/nil/test-workspace/a/.vscode/terminals.json
Users/nil/test-workspace/b/.vscode/terminals.json
Users/nil/test-workspace/c/.vscode/terminals.json
{
        "autorun": true,
        "autokill": true,
        "terminals": [
                {
                        "name": "a" // and b and c
                }
        ]
}

This works, but I still have tiny issues:

EDIT: What I would like to have is simply terminal per project/directory in workspace. Then it could automatically switch to right one after selecting file from different directory.

hannah23280 commented 3 years ago

I upvote this suggestion. I have 3 workspace root folders, each with its own terminals.json. When i execute terminals: Run, it will only run the terminals.json for the specific workspace folder which currently contain the open active file. In order to run the terminals for all the 3 root folders, i have to manually open a fle from each folder, and execute terminals: Run. Imaging i have 10 workspace folders...

hannah23280 commented 3 years ago

Any follow up for this?

fabiospampinato commented 3 years ago

Duplicate of #47