Skip to content

Commit 9b4f2cc

Browse files
authored
Merge pull request #178 from NativeScript/iiivanov/show-output-command
Add command to open the output
2 parents 8aa7076 + de7749d commit 9b4f2cc

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
"command": "nativescript.runAndroid",
9292
"title": "Run on Android",
9393
"category": "NativeScript"
94+
},
95+
{
96+
"command": "nativescript.showOutputChannel",
97+
"title": "Show Output Channel",
98+
"category": "NativeScript"
9499
}
95100
],
96101
"keybindings": [
@@ -103,6 +108,11 @@
103108
"command": "nativescript.runAndroid",
104109
"key": "ctrl+alt+a",
105110
"mac": "cmd+alt+a"
111+
},
112+
{
113+
"command": "nativescript.showOutputChannel",
114+
"key": "ctrl+alt+n ctrl+alt+o",
115+
"mac": "cmd+alt+n cmd+alt+o"
106116
}
107117
],
108118
"debuggers": [

src/main.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ export function activate(context: vscode.ExtensionContext) {
2626
vscode.window.showErrorMessage(cliVersion.errorMessage);
2727
}
2828

29-
logInfo(cliVersion.version.toString());
29+
let channel = createInfoChannel(cliVersion.version.toString());
30+
let showOutputChannelCommand = vscode.commands.registerCommand('nativescript.showOutputChannel', () => {
31+
channel.show();
32+
});
3033

3134
let runCommand = (project: Project) => {
3235
if (vscode.workspace.rootPath === undefined) {
@@ -74,16 +77,19 @@ export function activate(context: vscode.ExtensionContext) {
7477

7578
context.subscriptions.push(runIosCommand);
7679
context.subscriptions.push(runAndroidCommand);
80+
context.subscriptions.push(showOutputChannelCommand);
7781
}
7882

79-
function logInfo(cliVersion: string) {
83+
function createInfoChannel(cliVersion: string): vscode.OutputChannel {
8084
let channel = vscode.window.createOutputChannel("NativeScript Extension");
8185
const packageJSON = vscode.extensions.getExtension("Telerik.nativescript").packageJSON;
8286

8387
packageJSON.version && channel.appendLine(`Version: ${packageJSON.version}`);
8488
packageJSON.buildVersion && channel.appendLine(`Build version: ${packageJSON.buildVersion}`);
8589
packageJSON.commitId && channel.appendLine(`Commit id: ${packageJSON.commitId}`);
8690
channel.appendLine(`NativeScript CLI: ${cliVersion}`);
91+
92+
return channel;
8793
}
8894

8995
export function deactivate() {

0 commit comments

Comments
 (0)