mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Fix tslint error
This commit is contained in:
parent
b3683df0cd
commit
ac8f35019b
2 changed files with 65 additions and 63 deletions
37
editors/code/src/commands/watch_status.ts
Normal file
37
editors/code/src/commands/watch_status.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import * as timers from 'timers';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
|
||||
export class StatusDisplay {
|
||||
private i = 0;
|
||||
private statusBarItem: vscode.StatusBarItem;
|
||||
private timer?: NodeJS.Timeout;
|
||||
|
||||
constructor(subscriptions: vscode.Disposable[]) {
|
||||
this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10);
|
||||
subscriptions.push(this.statusBarItem);
|
||||
this.statusBarItem.hide();
|
||||
}
|
||||
|
||||
public show() {
|
||||
this.timer = this.timer || setInterval(() => {
|
||||
this.statusBarItem!.text = 'cargo check ' + this.frame();
|
||||
}, 300);
|
||||
|
||||
this.statusBarItem!.show();
|
||||
}
|
||||
|
||||
public hide() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = undefined;
|
||||
}
|
||||
|
||||
this.statusBarItem!.hide();
|
||||
}
|
||||
|
||||
private frame() {
|
||||
return spinnerFrames[this.i = ++this.i % spinnerFrames.length];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue