mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Re-implement status display using LSP 3.15 progress event
This commit is contained in:
parent
500fe46e6c
commit
178c23f505
4 changed files with 103 additions and 9 deletions
|
@ -57,7 +57,50 @@ export class StatusDisplay implements vscode.Disposable {
|
|||
this.statusBarItem.dispose();
|
||||
}
|
||||
|
||||
public handleProgressNotification(params: ProgressParams) {
|
||||
const { token, value } = params;
|
||||
if (token !== "rustAnalyzer/cargoWatcher") {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Got progress notification", token, value)
|
||||
switch (value.kind) {
|
||||
case "begin":
|
||||
this.show();
|
||||
break;
|
||||
|
||||
case "report":
|
||||
if (value.message) {
|
||||
this.packageName = value.message;
|
||||
}
|
||||
break;
|
||||
|
||||
case "end":
|
||||
this.hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private frame() {
|
||||
return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)];
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Replace this once vscode-languageclient is updated to LSP 3.15
|
||||
interface ProgressParams {
|
||||
token: string
|
||||
value: WorkDoneProgress
|
||||
}
|
||||
|
||||
enum WorkDoneProgressKind {
|
||||
Begin = "begin",
|
||||
Report = "report",
|
||||
End = "end"
|
||||
}
|
||||
|
||||
interface WorkDoneProgress {
|
||||
kind: WorkDoneProgressKind,
|
||||
message?: string
|
||||
cancelable?: boolean
|
||||
percentage?: string
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue