Skip to content

Commit c409520

Browse files
committed
add rebuild button
1 parent 4f5becd commit c409520

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,11 @@
814814
"default": true,
815815
"description": "Show build button in status bar"
816816
},
817+
"xmake.status.showRebuild": {
818+
"type": "boolean",
819+
"default": true,
820+
"description": "Show rebuild button in status bar"
821+
},
817822
"xmake.status.showRun": {
818823
"type": "boolean",
819824
"default": true,

src/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ export class Config {
159159
return this.get<boolean>("status.showBuild");
160160
}
161161

162+
// show rebuild button in status bar
163+
get statusShowRebuild(): boolean {
164+
return this.get<boolean>("status.showRebuild");
165+
}
166+
162167
// show run button in status bar
163168
get statusShowRun(): boolean {
164169
return this.get<boolean>("status.showRun");

src/status.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export class Status implements vscode.Disposable {
2929
// the build button
3030
private _buildButton: vscode.StatusBarItem;
3131

32+
// the rebuild button
33+
private _rebuildButton: vscode.StatusBarItem;
34+
3235
// the target button
3336
private _targetButton: vscode.StatusBarItem;
3437

@@ -76,6 +79,7 @@ export class Status implements vscode.Disposable {
7679
let modeButtonText = this._modeButton ? this._modeButton.text : null;
7780
let toolChainButtonText = this._toolChainButton ? this._toolChainButton.text : null;
7881
let buildButtonText = this._buildButton ? this._buildButton.text : null;
82+
let rebuildButtonText = this._rebuildButton ? this._rebuildButton.text : null;
7983
let targetButtonText = this._targetButton ? this._targetButton.text : null;
8084
let runButtonText = this._runButton ? this._runButton.text : null;
8185
let debugButtonText = this._debugButton ? this._debugButton.text : null;
@@ -88,6 +92,7 @@ export class Status implements vscode.Disposable {
8892
if (this._modeButton) { this._modeButton.hide(); this._modeButton.dispose(); }
8993
if (this._toolChainButton) { this._toolChainButton.hide(); this._toolChainButton.dispose(); }
9094
if (this._buildButton) { this._buildButton.hide(); this._buildButton.dispose(); }
95+
if (this._rebuildButton) { this._rebuildButton.hide(); this._rebuildButton.dispose(); }
9196
if (this._targetButton) { this._targetButton.hide(); this._targetButton.dispose(); }
9297
if (this._runButton) { this._runButton.hide(); this._runButton.dispose(); }
9398
if (this._debugButton) { this._debugButton.hide(); this._debugButton.dispose(); }
@@ -149,6 +154,13 @@ export class Status implements vscode.Disposable {
149154
this._buildButton.text = restore && buildButtonText ? buildButtonText : `$(xmake-build)`;
150155
this._buildButton.tooltip = "Build the given target";
151156

157+
// init rebuild button
158+
this._rebuildButton = vscode.window.createStatusBarItem(
159+
"Xmake Rebuild" + idSuffix, alignment, 2450);
160+
this._rebuildButton.command = 'xmake.onRebuild';
161+
this._rebuildButton.text = restore && rebuildButtonText ? rebuildButtonText : `$(refresh)`;
162+
this._rebuildButton.tooltip = "Rebuild the given target";
163+
152164
// init target button
153165
this._targetButton = vscode.window.createStatusBarItem(
154166
"Xmake Config: Target" + idSuffix, alignment, 2400);
@@ -177,6 +189,7 @@ export class Status implements vscode.Disposable {
177189
this._archButton,
178190
this._modeButton,
179191
this._buildButton,
192+
this._rebuildButton,
180193
this._targetButton,
181194
this._runButton,
182195
this._debugButton,
@@ -199,6 +212,7 @@ export class Status implements vscode.Disposable {
199212
this._archButton,
200213
this._modeButton,
201214
this._buildButton,
215+
this._rebuildButton,
202216
this._targetButton,
203217
this._runButton,
204218
this._debugButton,
@@ -221,6 +235,7 @@ export class Status implements vscode.Disposable {
221235
{ item: this._archButton, show: config.statusShowArch },
222236
{ item: this._modeButton, show: config.statusShowMode },
223237
{ item: this._buildButton, show: config.statusShowBuild },
238+
{ item: this._rebuildButton, show: config.statusShowRebuild },
224239
{ item: this._targetButton, show: config.statusShowTarget },
225240
{ item: this._runButton, show: config.statusShowRun },
226241
{ item: this._debugButton, show: config.statusShowDebug },

0 commit comments

Comments
 (0)