diff --git a/terminal-sample/package.json b/terminal-sample/package.json index 84607311..27caa13d 100644 --- a/terminal-sample/package.json +++ b/terminal-sample/package.json @@ -27,7 +27,8 @@ "onCommand:terminalTest.show", "onCommand:terminalTest.showPreserveFocus", "onCommand:terminalTest.terminals", - "onCommand:terminalTest.updateEnvironment" + "onCommand:terminalTest.updateEnvironment", + "onCommand:terminalTest.clearEnvironment" ], "main": "./out/extension.js", "contributes": { @@ -95,6 +96,10 @@ { "command": "terminalTest.updateEnvironment", "title": "Terminal API: Update environment" + }, + { + "command": "terminalTest.clearEnvironment", + "title": "Terminal API: Clear environment" } ] }, diff --git a/terminal-sample/src/extension.ts b/terminal-sample/src/extension.ts index 2e605f77..17a370ea 100644 --- a/terminal-sample/src/extension.ts +++ b/terminal-sample/src/extension.ts @@ -146,10 +146,15 @@ export function activate(context: vscode.ExtensionContext) { })); context.subscriptions.push(vscode.commands.registerCommand('terminalTest.updateEnvironment', () => { - const collection = (vscode.window).getEnvironmentVariableCollection(); + const collection = (context as any).environmentVariableCollection; collection.replace('FOO', 'BAR'); collection.append('PATH', '/test/path'); })); + + context.subscriptions.push(vscode.commands.registerCommand('terminalTest.clearEnvironment', () => { + const collection = (context as any).environmentVariableCollection; + collection.clear(); + })); } function colorText(text: string): string {