aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/watch_status.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/watch_status.ts')
-rw-r--r--editors/code/src/commands/watch_status.ts63
1 files changed, 0 insertions, 63 deletions
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts
deleted file mode 100644
index 8d64394c7..000000000
--- a/editors/code/src/commands/watch_status.ts
+++ /dev/null
@@ -1,63 +0,0 @@
1import * as vscode from 'vscode';
2
3const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
4
5export class StatusDisplay implements vscode.Disposable {
6 public packageName?: string;
7
8 private i = 0;
9 private statusBarItem: vscode.StatusBarItem;
10 private command: string;
11 private timer?: NodeJS.Timeout;
12
13 constructor(command: string) {
14 this.statusBarItem = vscode.window.createStatusBarItem(
15 vscode.StatusBarAlignment.Left,
16 10,
17 );
18 this.command = command;
19 this.statusBarItem.hide();
20 }
21
22 public show() {
23 this.packageName = undefined;
24
25 this.timer =
26 this.timer ||
27 setInterval(() => {
28 if (this.packageName) {
29 this.statusBarItem!.text = `cargo ${this.command} [${
30 this.packageName
31 }] ${this.frame()}`;
32 } else {
33 this.statusBarItem!.text = `cargo ${
34 this.command
35 } ${this.frame()}`;
36 }
37 }, 300);
38
39 this.statusBarItem.show();
40 }
41
42 public hide() {
43 if (this.timer) {
44 clearInterval(this.timer);
45 this.timer = undefined;
46 }
47
48 this.statusBarItem.hide();
49 }
50
51 public dispose() {
52 if (this.timer) {
53 clearInterval(this.timer);
54 this.timer = undefined;
55 }
56
57 this.statusBarItem.dispose();
58 }
59
60 private frame() {
61 return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)];
62 }
63}