aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorEmil Lauridsen <[email protected]>2019-12-25 18:08:44 +0000
committerEmil Lauridsen <[email protected]>2019-12-25 18:08:44 +0000
commit178c23f50549298aad0dc0f098f8ed510a57f9d6 (patch)
treecd6a937505d5f14aec9c960ee7ac21a943f24118 /editors/code/src/commands
parent500fe46e6c0df7827d56c7cd07741533422e7743 (diff)
Re-implement status display using LSP 3.15 progress event
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/watch_status.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts
index 8d64394c7..2404c3f16 100644
--- a/editors/code/src/commands/watch_status.ts
+++ b/editors/code/src/commands/watch_status.ts
@@ -57,7 +57,50 @@ export class StatusDisplay implements vscode.Disposable {
57 this.statusBarItem.dispose(); 57 this.statusBarItem.dispose();
58 } 58 }
59 59
60 public handleProgressNotification(params: ProgressParams) {
61 const { token, value } = params;
62 if (token !== "rustAnalyzer/cargoWatcher") {
63 return;
64 }
65
66 console.log("Got progress notification", token, value)
67 switch (value.kind) {
68 case "begin":
69 this.show();
70 break;
71
72 case "report":
73 if (value.message) {
74 this.packageName = value.message;
75 }
76 break;
77
78 case "end":
79 this.hide();
80 break;
81 }
82 }
83
60 private frame() { 84 private frame() {
61 return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; 85 return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)];
62 } 86 }
63} 87}
88
89// FIXME: Replace this once vscode-languageclient is updated to LSP 3.15
90interface ProgressParams {
91 token: string
92 value: WorkDoneProgress
93}
94
95enum WorkDoneProgressKind {
96 Begin = "begin",
97 Report = "report",
98 End = "end"
99}
100
101interface WorkDoneProgress {
102 kind: WorkDoneProgressKind,
103 message?: string
104 cancelable?: boolean
105 percentage?: string
106} \ No newline at end of file