mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Add clear command and update to use new api
This commit is contained in:
@ -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"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -146,10 +146,15 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
}));
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('terminalTest.updateEnvironment', () => {
|
||||
const collection = (<any>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 {
|
||||
|
||||
Reference in New Issue
Block a user