mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Add cargo-watch package animation and refactoring
This commit is contained in:
parent
5cdf525caa
commit
88bcaf0e18
2 changed files with 78 additions and 44 deletions
|
@ -3,6 +3,8 @@ import * as vscode from 'vscode';
|
|||
const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
|
||||
export class StatusDisplay {
|
||||
public packageName?: string;
|
||||
|
||||
private i = 0;
|
||||
private statusBarItem: vscode.StatusBarItem;
|
||||
private timer?: NodeJS.Timeout;
|
||||
|
@ -17,10 +19,18 @@ export class StatusDisplay {
|
|||
}
|
||||
|
||||
public show() {
|
||||
this.packageName = undefined;
|
||||
|
||||
this.timer =
|
||||
this.timer ||
|
||||
setInterval(() => {
|
||||
this.statusBarItem!.text = 'cargo check ' + this.frame();
|
||||
if (this.packageName) {
|
||||
this.statusBarItem!.text = `cargo check [${
|
||||
this.packageName
|
||||
}] ${this.frame()}`;
|
||||
} else {
|
||||
this.statusBarItem!.text = `cargo check ${this.frame()}`;
|
||||
}
|
||||
}, 300);
|
||||
|
||||
this.statusBarItem!.show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue