PowerShell / PowerShell/vscode-powershell

Feature Request: Make the PowerShell Extension profile available as a profile.

Open
#4,412 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Extension Terminal Issue-Enhancement
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary

Hello,

I am not good enough with TypeScript/JavaScript to say that I would be able to help actually implement it, but I would like to help if possible.

Currently the extension creates a terminal window and passes the startup scripts to the terminal in code. I would like to propose the idea of fully integrating the terminal created by the extension as.

This would add the following benefits:

  • Users would the ability to have the PowerShell Extension show as one or more profiles in the profile selector.
  • Users can select the PowerShell Extension profile as their default profile in the profile selector.
  • Users can pass arguments to the PowerShell profile at runtime.
  • Make it easier to work with sessions.
  • Existing command workbench.action.terminal.relaunch could be used in place of PowerShell.RestartSession

Users would be able to configure the profile by adding the profile Json to their settings.

{
	"terminal.integrated.profiles.windows": {
		"PowerShell Extension": {
			"title": "PowerShell Extension",
			"env": {
				"${env:Example}": "Test"
			},
			"overrideName": false,
			"args": [],
			"id": "ms-vscode.powershell.PowerShell-Extension",
			"extensionIdentifier": "ms-vscode.powershell"
		}
	}
}
Proposed Design

The way this could be implemented is by adding in the code to have the extension be a terminal provider. Example below taken from the VSCode API reference.

contributes.terminal

Contribute a terminal profile to VS Code, allowing extensions to handle the creation of the profiles. When defined, the profile should appear when creating the terminal profile.

{
  "activationEvents": [
    "onTerminalProfile:my-ext.terminal-profile"
  ],
  "contributes": {
    "terminal": {
      "profiles": [
        {
          "title": "Profile from extension",
          "id": "my-ext.terminal-profile"
        }
      ]
    },
  }
}

When defined, the profile will show up in the terminal profile selector. When activated, handle the creation of the profile by returning terminal options:

vscode.window.registerTerminalProfileProvider('my-ext.terminal-profile', {
  provideProfileOptions(token: vscode.CancellationToken): vscode.ProviderResult<vscode.TerminalOptions | vscode.ExtensionTerminalOptions> {
    return {
      name: 'Profile from extension',
      shellPath: 'bash'
    };
  }
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the extension's current terminal creation and startup-script handling, then compare it with VS Code's contributes.terminal and registerTerminalProfileProvider APIs described here. Done means the extension appears in the terminal profile selector, supports configuration and runtime arguments, and can use the standard terminal relaunch flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
cli, developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.