Add sample call to terminal-sample

Part of microsoft/vscode#46696
This commit is contained in:
Daniel Imms
2020-04-17 09:28:16 -07:00
parent e8da8b531a
commit 81d47e06b1
2 changed files with 12 additions and 3 deletions

View File

@ -26,7 +26,8 @@
"onCommand:terminalTest.sendTextNoNewLine",
"onCommand:terminalTest.show",
"onCommand:terminalTest.showPreserveFocus",
"onCommand:terminalTest.terminals"
"onCommand:terminalTest.terminals",
"onCommand:terminalTest.updateEnvironment"
],
"main": "./out/extension.js",
"contributes": {
@ -90,6 +91,10 @@
{
"command": "terminalTest.terminals",
"title": "Terminal API: View terminals"
},
{
"command": "terminalTest.updateEnvironment",
"title": "Terminal API: Update environment"
}
]
},

View File

@ -5,8 +5,6 @@ import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
let NEXT_TERM_ID = 1;
vscode.window.showInformationMessage('Hello World!');
console.log("Terminals: " + (<any>vscode.window).terminals.length);
// vscode.window.onDidOpenTerminal
@ -146,6 +144,12 @@ export function activate(context: vscode.ExtensionContext) {
console.log(`onDidChangeTerminalDimensions: terminal:${event.terminal.name}, columns=${event.dimensions.columns}, rows=${event.dimensions.rows}`);
});
}));
context.subscriptions.push(vscode.commands.registerCommand('terminalTest.updateEnvironment', () => {
const collection = (<any>vscode.window).getEnvironmentVariableCollection();
collection.replace('FOO', 'BAR');
collection.append('PATH', '/test/path');
}));
}
function colorText(text: string): string {