Skip to content

Commit

Permalink
Add sample call to terminal-sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Apr 17, 2020
1 parent e8da8b5 commit 81d47e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion terminal-sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -90,6 +91,10 @@
{
"command": "terminalTest.terminals",
"title": "Terminal API: View terminals"
},
{
"command": "terminalTest.updateEnvironment",
"title": "Terminal API: Update environment"
}
]
},
Expand Down
8 changes: 6 additions & 2 deletions terminal-sample/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 81d47e0

Please sign in to comment.