diff --git a/terminal-sample/README.md b/terminal-sample/README.md index 84f7945f..e53f43a6 100644 --- a/terminal-sample/README.md +++ b/terminal-sample/README.md @@ -19,10 +19,12 @@ This sample provides several commands that demonstrates how to utilize the integ - `window.createTerminalRenderer` - `window.TerminalRenderer` +- `window.registerTerminalProfileProvider` ### Contribution Points - [`contributes.commands`](https://code.visualstudio.com/api/references/contribution-points#contributes.commands) +- [`contributes.terminal`](https://code.visualstudio.com/updates/v1_57#_terminal-profile-contributions) ## Running the Sample diff --git a/terminal-sample/package.json b/terminal-sample/package.json index 04a51b69..52f519ae 100644 --- a/terminal-sample/package.json +++ b/terminal-sample/package.json @@ -35,7 +35,8 @@ "onCommand:terminalTest.showPreserveFocus", "onCommand:terminalTest.terminals", "onCommand:terminalTest.updateEnvironment", - "onCommand:terminalTest.clearEnvironment" + "onCommand:terminalTest.clearEnvironment", + "onTerminalProfile:terminalTest.profile" ], "main": "./out/extension.js", "contributes": { @@ -112,7 +113,16 @@ "command": "terminalTest.registerTerminalLinkProvider", "title": "Terminal API: Register link provider" } - ] + ], + "terminal": { + "profiles": [ + { + "id": "terminalTest.profile", + "icon": "terminal", + "title": "Terminal API Profile" + } + ] + } }, "scripts": { "vscode:prepublish": "npm run compile", diff --git a/terminal-sample/src/extension.ts b/terminal-sample/src/extension.ts index 24b2223b..fc30e6b6 100644 --- a/terminal-sample/src/extension.ts +++ b/terminal-sample/src/extension.ts @@ -180,6 +180,15 @@ export function activate(context: vscode.ExtensionContext) { } }); })); + + context.subscriptions.push(vscode.window.registerTerminalProfileProvider('terminalTest.profile', { + provideProfileOptions(token: vscode.CancellationToken): vscode.ProviderResult { + return { + name: 'Terminal API Profile', + shellPath: process.env.shell || 'C:/Windows/System32/cmd.exe' + }; + } + })); } function colorText(text: string): string {