Skip to content

Run tasks in Integrated Terminal on workspace startup #2383

Open
@gaelcolas

Description

@gaelcolas

Summary of the new feature

As a user of standardized pipeline automation (same build on over 50 DSC repos), I want to be able to set my Integrated Terminal session when I open the repository (set the $Env:PSModulePath for that session to path within the workspace, and alert of missing required modules defined in a RequiredModules.psd1 file).

Proposed technical implementation details (optional)

This could be handled by a task, currently we're running ./build.ps1 -tasks noop, but it should runOn when the folderOpen, IN the integrated terminal.

The task looks like this:

{
    "version": "2.0.0",
    "_runner": "terminal",
    "tasks": [
        {
            "label": "bootstrap_environment",
            "type": "shell",
            "command": "& ${cwd}/build.ps1",
            "args": ["-Tasks","noop"],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            },
            "runOptions": {
                "runOn": "folderOpen"
            },
            "problemMatcher": [
			    //...
			]
		}
	]
}

The only "missing" part here is that it's not running in the integrated terminal.

Even better would be to enable those tasks to be "Optionally Integrated within the VSCode PowerShell extension", so that we could run the same tasks either inside or outside the integrated terminal (useful to do validate a build/test run on a clean session).

We could imagine having powershell extension configurations in settings.json like so:

"powershell.integratedConsole.startupTask": "bootstrap_environment",
"powershell.tasks": [
	"${bootstrap_environment}"
]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions