-
Notifications
You must be signed in to change notification settings - Fork 521
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.
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' }; } });