Skip to content

Commit 3f93bb2

Browse files
committed
Add extension icon into status bar
1 parent 7c61dfc commit 3f93bb2

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-mbed",
33
"displayName": "vscode-mbed",
4-
"description": "VSCode extension for MBED",
4+
"description": "VSCode extension for ARMmbed",
55
"version": "0.0.1",
66
"publisher": "semonec",
77
"engines": {

src/extension.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,32 @@ import * as vscode from 'vscode';
66
// this method is called when your extension is activated
77
// your extension is activated the very first time the command is executed
88
let commandOutput = null;
9-
let spawnCMD = require('spawn-command');
9+
let compileIcon: vscode.StatusBarItem;
10+
let flashIcon: vscode.StatusBarItem;
11+
let logIcon: vscode.StatusBarItem;
12+
13+
const spawnCMD = require('spawn-command');
1014

1115
export function activate(context: vscode.ExtensionContext) {
1216
console.log('Congratulations, your extension "vscode-mbed" is now active!');
13-
commandOutput = vscode.window.createOutputChannel('Shell');
17+
18+
// status bar item add
19+
compileIcon = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
20+
compileIcon.text = `$(diff-renamed) compile`;
21+
compileIcon.show();
22+
compileIcon.tooltip = 'Compile current mbed project';
23+
24+
flashIcon = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
25+
flashIcon.text = `$(circuit-board) flash`;
26+
flashIcon.tooltip = 'Flash complied mbed binary into board';
27+
flashIcon.show();
28+
29+
logIcon = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
30+
logIcon.text = `$(device-desktop) show output`;
31+
logIcon.tooltip = 'Show output mbed board';
32+
logIcon.show();
33+
34+
commandOutput = vscode.window.createOutputChannel('MBED output');
1435
context.subscriptions.push(commandOutput);
1536
// add 'mbed new'
1637
context.subscriptions.push(vscode.commands.registerCommand('extension.mbed.new', () => {
@@ -46,7 +67,7 @@ export function activate(context: vscode.ExtensionContext) {
4667

4768
export function run(cmd:string, cwd:string): Promise<void> {
4869
return new Promise((accept, reject) => {
49-
var opts : any = {};
70+
let opts : any = {};
5071
if (vscode.workspace) {
5172
opts.cwd = cwd;
5273
}
@@ -72,7 +93,8 @@ export function exec(cmd:string, cwd:string): Promise<void> {
7293
return;
7394
}
7495
commandOutput.clear();
75-
commandOutput.appendLine(`> Running \`${cmd}\`...`)
96+
commandOutput.show();
97+
commandOutput.appendLine(`> Running \`${cmd}\`...`);
7698
return run(cmd, cwd);
7799
}
78100

0 commit comments

Comments
 (0)