mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
@ -6,6 +6,7 @@ Several commands are exposed prefixed with "Terminal API" that show how to use t
|
||||
|
||||
- `Terminal API: Create Terminal`: Create a terminal
|
||||
- `Terminal API: Create Terminal and Immediately Send`: Create a terminal and immediately send text
|
||||
- `Terminal API: Create Terminal (zsh login shell)`: Create a zsh login shell terminal using a custom shell executable and arguments
|
||||
- `Terminal API: Hide`: Hides the most recently created terminal
|
||||
- `Terminal API: Show`: Shows the most recently created terminal
|
||||
- `Terminal API: Send Text`: Sends `echo "Hello World!"` to the terminal
|
||||
|
||||
@ -5,14 +5,15 @@
|
||||
"version": "0.0.1",
|
||||
"publisher": "Tyriar",
|
||||
"engines": {
|
||||
"vscode": "^1.0.0"
|
||||
"vscode": "^1.5.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onCommand:terminalTest.createTerminal",
|
||||
"onCommand:terminalTest.createAndSend"
|
||||
"onCommand:terminalTest.createAndSend",
|
||||
"onCommand:terminalTest.createZshLoginShell"
|
||||
],
|
||||
"main": "./out/src/extension",
|
||||
"contributes": {
|
||||
@ -40,6 +41,9 @@
|
||||
}, {
|
||||
"command": "terminalTest.createAndSend",
|
||||
"title": "Terminal API: Create Terminal and Immediately Send"
|
||||
}, {
|
||||
"command": "terminalTest.createZshLoginShell",
|
||||
"title": "Terminal API: Create Terminal (zsh login shell) [v1.6+]"
|
||||
}]
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@ -49,6 +49,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
terminalStack.push(vscode.window.createTerminal(`Ext Terminal #${terminalStack.length + 1}`));
|
||||
getLatestTerminal().sendText("echo 'Sent text immediately after creating'");
|
||||
}));
|
||||
context.subscriptions.push(vscode.commands.registerCommand('terminalTest.createZshLoginShell', () => {
|
||||
terminalStack.push((<any>vscode.window).createTerminal(`Ext Terminal #${terminalStack.length + 1}`, '/bin/zsh', ['-l']));
|
||||
}));
|
||||
|
||||
function getLatestTerminal() {
|
||||
return terminalStack[terminalStack.length - 1];
|
||||
|
||||
Reference in New Issue
Block a user