@@ -129,7 +129,7 @@ function makeRlsProcess(): Promise<child_process.ChildProcess> {
129
129
} ) ;
130
130
131
131
return childProcessPromise . catch ( ( ) => {
132
- window . setStatusBarMessage ( 'RLS could not be started' ) ;
132
+ stopSpinner ( 'RLS could not be started' ) ;
133
133
return Promise . reject ( undefined ) ;
134
134
} ) ;
135
135
}
@@ -151,7 +151,7 @@ function startLanguageClient(context: ExtensionContext)
151
151
}
152
152
warnOnMissingCargoToml ( ) ;
153
153
154
- window . setStatusBarMessage ( 'RLS: starting up ' ) ;
154
+ startSpinner ( 'RLS' , 'Starting ') ;
155
155
156
156
warnOnRlsToml ( ) ;
157
157
// Check for deprecated env vars.
@@ -172,7 +172,7 @@ function startLanguageClient(context: ExtensionContext)
172
172
// Create the language client and start the client.
173
173
lc = new LanguageClient ( 'Rust Language Server' , serverOptions , clientOptions ) ;
174
174
175
- diagnosticCounter ( ) ;
175
+ progressCounter ( ) ;
176
176
177
177
const disposable = lc . start ( ) ;
178
178
context . subscriptions . push ( disposable ) ;
@@ -207,17 +207,45 @@ async function autoUpdate() {
207
207
}
208
208
}
209
209
210
- function diagnosticCounter ( ) {
210
+ function progressCounter ( ) {
211
+ const runningProgress : Set < string > = new Set ( ) ;
212
+ const asPercent = ( fraction : number ) : string => `${ Math . round ( fraction * 100 ) } %` ;
211
213
let runningDiagnostics = 0 ;
212
214
lc . onReady ( ) . then ( ( ) => {
213
- lc . onNotification ( new NotificationType ( 'rustDocument/beginBuild' ) , function ( _f : any ) {
215
+
216
+ stopSpinner ( 'RLS' ) ;
217
+
218
+ lc . onNotification ( new NotificationType ( 'window/progress' ) , function ( progress : any ) {
219
+ if ( progress . done ) {
220
+ runningProgress . delete ( progress . id ) ;
221
+ } else {
222
+ runningProgress . add ( progress . id ) ;
223
+ }
224
+ if ( runningProgress . size ) {
225
+ let status = '' ;
226
+ if ( typeof progress . percentage === 'number' ) {
227
+ status = asPercent ( progress . percentage ) ;
228
+ } else if ( progress . message ) {
229
+ status = progress . message ;
230
+ } else if ( progress . title ) {
231
+ status = `[${ progress . title . toLowerCase ( ) } ]` ;
232
+ }
233
+ startSpinner ( 'RLS' , status ) ;
234
+ } else {
235
+ stopSpinner ( 'RLS' ) ;
236
+ }
237
+ } ) ;
238
+
239
+ // FIXME these are legacy notifications used by RLS ca jan 2018.
240
+ // remove once we're certain we've progress on.
241
+ lc . onNotification ( new NotificationType ( 'rustDocument/beginBuild' ) , function ( _f : any ) {
214
242
runningDiagnostics ++ ;
215
- startSpinner ( 'RLS: working' ) ;
243
+ startSpinner ( 'RLS' , ' working') ;
216
244
} ) ;
217
- lc . onNotification ( new NotificationType ( 'rustDocument/diagnosticsEnd' ) , function ( _f : any ) {
245
+ lc . onNotification ( new NotificationType ( 'rustDocument/diagnosticsEnd' ) , function ( _f : any ) {
218
246
runningDiagnostics -- ;
219
247
if ( runningDiagnostics <= 0 ) {
220
- stopSpinner ( 'RLS: done ' ) ;
248
+ stopSpinner ( 'RLS' ) ;
221
249
}
222
250
} ) ;
223
251
} ) ;
0 commit comments