@@ -282,41 +282,51 @@ export class Ctx {
282
282
setServerStatus ( status : ServerStatusParams | { health : "stopped" } ) {
283
283
let icon = "" ;
284
284
const statusBar = this . statusBar ;
285
+ statusBar . tooltip = new vscode . MarkdownString ( "" , true ) ;
286
+ statusBar . tooltip . isTrusted = true ;
285
287
switch ( status . health ) {
286
288
case "ok" :
287
- statusBar . tooltip = ( status . message ?? "Ready" ) + "\nClick to stop server." ;
288
- statusBar . command = "rust-analyzer.stopServer" ;
289
+ statusBar . tooltip . appendText ( status . message ?? "Ready" ) ;
289
290
statusBar . color = undefined ;
290
291
statusBar . backgroundColor = undefined ;
291
292
break ;
292
293
case "warning" :
293
- statusBar . tooltip =
294
- ( status . message ? status . message + "\n" : "" ) + "Click to reload." ;
295
-
296
- statusBar . command = "rust-analyzer.reloadWorkspace" ;
294
+ if ( status . message ) {
295
+ statusBar . tooltip . appendText ( status . message ) ;
296
+ }
297
297
statusBar . color = new vscode . ThemeColor ( "statusBarItem.warningForeground" ) ;
298
298
statusBar . backgroundColor = new vscode . ThemeColor (
299
299
"statusBarItem.warningBackground"
300
300
) ;
301
301
icon = "$(warning) " ;
302
302
break ;
303
303
case "error" :
304
- statusBar . tooltip =
305
- ( status . message ? status . message + "\n" : "" ) + "Click to reload." ;
306
-
307
- statusBar . command = "rust-analyzer.reloadWorkspace" ;
304
+ if ( status . message ) {
305
+ statusBar . tooltip . appendText ( status . message ) ;
306
+ }
308
307
statusBar . color = new vscode . ThemeColor ( "statusBarItem.errorForeground" ) ;
309
308
statusBar . backgroundColor = new vscode . ThemeColor ( "statusBarItem.errorBackground" ) ;
310
309
icon = "$(error) " ;
311
310
break ;
312
311
case "stopped" :
313
- statusBar . tooltip = "Server is stopped.\nClick to start." ;
314
- statusBar . command = "rust-analyzer.startServer" ;
312
+ statusBar . tooltip . appendText ( "Server is stopped" ) ;
313
+ statusBar . tooltip . appendMarkdown (
314
+ "\n\n[Start server](command:rust-analyzer.startServer)"
315
+ ) ;
315
316
statusBar . color = undefined ;
316
317
statusBar . backgroundColor = undefined ;
317
318
statusBar . text = `$(stop-circle) rust-analyzer` ;
318
319
return ;
319
320
}
321
+ if ( statusBar . tooltip . value ) {
322
+ statusBar . tooltip . appendText ( "\n\n" ) ;
323
+ }
324
+ statusBar . tooltip . appendMarkdown ( "[Stop server](command:rust-analyzer.stopServer)" ) ;
325
+ statusBar . tooltip . appendMarkdown (
326
+ "\n\n[Reload Workspace](command:rust-analyzer.reloadWorkspace)"
327
+ ) ;
328
+ statusBar . tooltip . appendMarkdown ( "\n\n[Restart server](command:rust-analyzer.startServer)" ) ;
329
+ statusBar . tooltip . appendMarkdown ( "\n\n[Open logs](command:rust-analyzer.openLogs)" ) ;
320
330
if ( ! status . quiescent ) icon = "$(sync~spin) " ;
321
331
statusBar . text = `${ icon } rust-analyzer` ;
322
332
}
0 commit comments