File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export function activateStatusDisplay(ctx: Ctx) {
17
17
class StatusDisplay implements vscode . Disposable {
18
18
packageName ?: string ;
19
19
20
- private i = 0 ;
20
+ private i : number = 0 ;
21
21
private statusBarItem : vscode . StatusBarItem ;
22
22
private command : string ;
23
23
private timer ?: NodeJS . Timeout ;
@@ -37,11 +37,8 @@ class StatusDisplay implements vscode.Disposable {
37
37
this . timer =
38
38
this . timer ||
39
39
setInterval ( ( ) => {
40
- if ( this . packageName ) {
41
- this . statusBarItem ! . text = `${ this . frame ( ) } cargo ${ this . command } [${ this . packageName } ]` ;
42
- } else {
43
- this . statusBarItem ! . text = `${ this . frame ( ) } cargo ${ this . command } ` ;
44
- }
40
+ this . tick ( ) ;
41
+ this . refreshLabel ( ) ;
45
42
} , 300 ) ;
46
43
47
44
this . statusBarItem . show ( ) ;
@@ -65,6 +62,14 @@ class StatusDisplay implements vscode.Disposable {
65
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
73
handleProgressNotification ( params : WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd ) {
69
74
switch ( params . kind ) {
70
75
case 'begin' :
@@ -74,6 +79,7 @@ class StatusDisplay implements vscode.Disposable {
74
79
case 'report' :
75
80
if ( params . message ) {
76
81
this . packageName = params . message ;
82
+ this . refreshLabel ( ) ;
77
83
}
78
84
break ;
79
85
@@ -83,7 +89,7 @@ class StatusDisplay implements vscode.Disposable {
83
89
}
84
90
}
85
91
86
- private frame ( ) {
87
- return spinnerFrames [ ( this . i = ++ this . i % spinnerFrames . length ) ] ;
92
+ private tick ( ) {
93
+ this . i = ( this . i + 1 ) % spinnerFrames . length ;
88
94
}
89
95
}
You can’t perform that action at this time.
0 commit comments