aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/watch_status.ts
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-20 15:02:36 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-20 15:02:36 +0100
commit526a6aba104a32eb9f0f5a65232783d5570c35d5 (patch)
treef8f6687924cb15a2d759dae02205b7f28a5f83fd /editors/code/src/commands/watch_status.ts
parent0d39b1c3fa03a8032ea96be922fd62710f811aba (diff)
parent4cd0a96c96870d4e9a73b92f401a8fad26f3c02a (diff)
Merge #1174
1174: improve cargo watch r=matklad a=vemoo - Add start and stop commands - Cleanup trypescript code to avoid definite assignment assertions (`!` after possibly undefined value) - Recover `rustc-watch` problem matcher because it's still useful, can be used with any command, for example `cargo test` Co-authored-by: Bernardo <[email protected]>
Diffstat (limited to 'editors/code/src/commands/watch_status.ts')
-rw-r--r--editors/code/src/commands/watch_status.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts
index 86ae821de..a3b0178f2 100644
--- a/editors/code/src/commands/watch_status.ts
+++ b/editors/code/src/commands/watch_status.ts
@@ -2,19 +2,18 @@ import * as vscode from 'vscode';
2 2
3const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; 3const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
4 4
5export class StatusDisplay { 5export class StatusDisplay implements vscode.Disposable {
6 public packageName?: string; 6 public packageName?: string;
7 7
8 private i = 0; 8 private i = 0;
9 private statusBarItem: vscode.StatusBarItem; 9 private statusBarItem: vscode.StatusBarItem;
10 private timer?: NodeJS.Timeout; 10 private timer?: NodeJS.Timeout;
11 11
12 constructor(subscriptions: vscode.Disposable[]) { 12 constructor() {
13 this.statusBarItem = vscode.window.createStatusBarItem( 13 this.statusBarItem = vscode.window.createStatusBarItem(
14 vscode.StatusBarAlignment.Left, 14 vscode.StatusBarAlignment.Left,
15 10 15 10
16 ); 16 );
17 subscriptions.push(this.statusBarItem);
18 this.statusBarItem.hide(); 17 this.statusBarItem.hide();
19 } 18 }
20 19
@@ -33,7 +32,7 @@ export class StatusDisplay {
33 } 32 }
34 }, 300); 33 }, 300);
35 34
36 this.statusBarItem!.show(); 35 this.statusBarItem.show();
37 } 36 }
38 37
39 public hide() { 38 public hide() {
@@ -42,7 +41,16 @@ export class StatusDisplay {
42 this.timer = undefined; 41 this.timer = undefined;
43 } 42 }
44 43
45 this.statusBarItem!.hide(); 44 this.statusBarItem.hide();
45 }
46
47 public dispose() {
48 if (this.timer) {
49 clearInterval(this.timer);
50 this.timer = undefined;
51 }
52
53 this.statusBarItem.dispose();
46 } 54 }
47 55
48 private frame() { 56 private frame() {