aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/status_display.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/editors/code/src/status_display.ts b/editors/code/src/status_display.ts
index c75fddf9d..7345bc3f5 100644
--- a/editors/code/src/status_display.ts
+++ b/editors/code/src/status_display.ts
@@ -17,7 +17,7 @@ export function activateStatusDisplay(ctx: Ctx) {
17class StatusDisplay implements vscode.Disposable { 17class StatusDisplay implements vscode.Disposable {
18 packageName?: string; 18 packageName?: string;
19 19
20 private i = 0; 20 private i: number = 0;
21 private statusBarItem: vscode.StatusBarItem; 21 private statusBarItem: vscode.StatusBarItem;
22 private command: string; 22 private command: string;
23 private timer?: NodeJS.Timeout; 23 private timer?: NodeJS.Timeout;
@@ -37,11 +37,8 @@ class StatusDisplay implements vscode.Disposable {
37 this.timer = 37 this.timer =
38 this.timer || 38 this.timer ||
39 setInterval(() => { 39 setInterval(() => {
40 if (this.packageName) { 40 this.tick();
41 this.statusBarItem!.text = `${this.frame()} cargo ${this.command} [${this.packageName}]`; 41 this.refreshLabel();
42 } else {
43 this.statusBarItem!.text = `${this.frame()} cargo ${this.command}`;
44 }
45 }, 300); 42 }, 300);
46 43
47 this.statusBarItem.show(); 44 this.statusBarItem.show();
@@ -65,6 +62,14 @@ class StatusDisplay implements vscode.Disposable {
65 this.statusBarItem.dispose(); 62 this.statusBarItem.dispose();
66 } 63 }
67 64
65 refreshLabel() {
66 if (this.packageName) {
67 this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command} [${this.packageName}]`;
68 } else {
69 this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command}`;
70 }
71 }
72
68 handleProgressNotification(params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd) { 73 handleProgressNotification(params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd) {
69 switch (params.kind) { 74 switch (params.kind) {
70 case 'begin': 75 case 'begin':
@@ -74,6 +79,7 @@ class StatusDisplay implements vscode.Disposable {
74 case 'report': 79 case 'report':
75 if (params.message) { 80 if (params.message) {
76 this.packageName = params.message; 81 this.packageName = params.message;
82 this.refreshLabel();
77 } 83 }
78 break; 84 break;
79 85
@@ -83,7 +89,7 @@ class StatusDisplay implements vscode.Disposable {
83 } 89 }
84 } 90 }
85 91
86 private frame() { 92 private tick() {
87 return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; 93 this.i = (this.i + 1) % spinnerFrames.length;
88 } 94 }
89} 95}