microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.39k stars 28.62k forks source link

tasks.json support to reuse the same shell #225478

Open Llorx opened 1 month ago

Llorx commented 1 month ago

Just reopening this: https://github.com/microsoft/vscode/issues/168947 by @stawiski

I'd like to be able to "truly" reuse shell when running tasks from tasks.json that are dependent on each other. For example, I have a task that needs to activate python environment such as:

source ~/.pyenv/esp-idf/bin/activate

To perform a build using CMake my current task command (in tasks.json) looks something like this:

"command": "source ~/.pyenv/esp-idf/bin/activate && cmake ...

I have to repeat this pyenv activation across different tasks. Instead I would like to create another task called "setup" and make other tasks depend on it, such as:

{
    "label": "setup",
    "type": "shell",
    "command": "source ~/.pyenv/esp-idf/bin/activate"
},
{
    "label": "build",
    "type": "shell",
    "dependsOrder": "sequence",
    "dependsOn": [
        "setup"
    ],
    "command": "cmake ...",
    ...
},

However this seems to be currently not supported, as each task runs in a new shell. I tried using "panel": "shared" configuration option, but that only shares stdout of the terminals, it does not preserve shell between task commands.

Cheers

vs-code-engineering[bot] commented 2 weeks ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!