@@ -108,11 +108,13 @@ function onDidChangeActiveTextEditor(editor: TextEditor | undefined) {
108
108
109
109
activeWorkspace = workspace ;
110
110
111
- const updateProgress = ( progress : { message : string } | null ) => {
112
- if ( progress ) {
111
+ const updateProgress = ( progress : WorkspaceProgress ) => {
112
+ if ( progress . state === 'progress' ) {
113
113
startSpinner ( `[${ workspace . folder . name } ] ${ progress . message } ` ) ;
114
114
} else {
115
- stopSpinner ( `[${ workspace . folder . name } ]` ) ;
115
+ const readySymbol =
116
+ progress . state === 'standby' ? '$(debug-stop)' : '$(debug-start)' ;
117
+ stopSpinner ( `[${ workspace . folder . name } ] ${ readySymbol } ` ) ;
116
118
}
117
119
} ;
118
120
@@ -166,6 +168,11 @@ function clientWorkspaceForUri(
166
168
return workspaces . get ( folder . uri . toString ( ) ) ;
167
169
}
168
170
171
+ /** Denotes the state or progress the workspace is currently in. */
172
+ type WorkspaceProgress =
173
+ | { state : 'progress' ; message : string }
174
+ | { state : 'ready' | 'standby' } ;
175
+
169
176
// We run one RLS and one corresponding language client per workspace folder
170
177
// (VSCode workspace, not Cargo workspace). This class contains all the per-client
171
178
// and per-workspace stuff.
@@ -176,7 +183,7 @@ class ClientWorkspace {
176
183
private readonly config : RLSConfiguration ;
177
184
private lc : LanguageClient | null = null ;
178
185
private disposables : Disposable [ ] ;
179
- private _progress : Observable < { message : string } | null > ;
186
+ private _progress : Observable < WorkspaceProgress > ;
180
187
get progress ( ) {
181
188
return this . _progress ;
182
189
}
@@ -185,7 +192,7 @@ class ClientWorkspace {
185
192
this . config = RLSConfiguration . loadFromWorkspace ( folder . uri . fsPath ) ;
186
193
this . folder = folder ;
187
194
this . disposables = [ ] ;
188
- this . _progress = new Observable < { message : string } | null > ( null ) ;
195
+ this . _progress = new Observable < WorkspaceProgress > ( { state : 'standby' } ) ;
189
196
}
190
197
191
198
/**
@@ -198,7 +205,7 @@ class ClientWorkspace {
198
205
}
199
206
200
207
public async start ( ) {
201
- this . _progress . value = { message : 'Starting' } ;
208
+ this . _progress . value = { state : 'progress' , message : 'Starting' } ;
202
209
203
210
const serverOptions : ServerOptions = async ( ) => {
204
211
await this . autoUpdate ( ) ;
@@ -275,6 +282,7 @@ class ClientWorkspace {
275
282
if ( this . lc ) {
276
283
await this . lc . stop ( ) ;
277
284
this . lc = null ;
285
+ this . _progress . value = { state : 'standby' } ;
278
286
}
279
287
280
288
this . disposables . forEach ( d => d . dispose ( ) ) ;
@@ -318,9 +326,9 @@ class ClientWorkspace {
318
326
} else if ( progress . title ) {
319
327
status = `[${ progress . title . toLowerCase ( ) } ]` ;
320
328
}
321
- this . _progress . value = { message : status } ;
329
+ this . _progress . value = { state : 'progress' , message : status } ;
322
330
} else {
323
- this . _progress . value = null ;
331
+ this . _progress . value = { state : 'ready' } ;
324
332
}
325
333
} ,
326
334
) ;
0 commit comments