@@ -94,6 +94,7 @@ export class Ctx {
94
94
private unlinkedFiles : vscode . Uri [ ] ;
95
95
private _dependencies : RustDependenciesProvider | undefined ;
96
96
private _treeView : vscode . TreeView < Dependency | DependencyFile | DependencyId > | undefined ;
97
+ private lastStatus : ServerStatusParams | { health : "stopped" } = { health : "stopped" } ;
97
98
98
99
get client ( ) {
99
100
return this . _client ;
@@ -404,7 +405,15 @@ export class Ctx {
404
405
}
405
406
406
407
setServerStatus ( status : ServerStatusParams | { health : "stopped" } ) {
408
+ this . lastStatus = status ;
409
+ this . updateStatusBarItem ( ) ;
410
+ }
411
+ refreshServerStatus ( ) {
412
+ this . updateStatusBarItem ( ) ;
413
+ }
414
+ private updateStatusBarItem ( ) {
407
415
let icon = "" ;
416
+ const status = this . lastStatus ;
408
417
const statusBar = this . statusBar ;
409
418
statusBar . show ( ) ;
410
419
statusBar . tooltip = new vscode . MarkdownString ( "" , true ) ;
@@ -447,13 +456,18 @@ export class Ctx {
447
456
"statusBarItem.warningBackground" ,
448
457
) ;
449
458
statusBar . command = "rust-analyzer.startServer" ;
450
- statusBar . text = ` $(stop-circle) rust-analyzer` ;
459
+ statusBar . text = " $(stop-circle) rust-analyzer" ;
451
460
return ;
452
461
}
453
462
if ( statusBar . tooltip . value ) {
454
463
statusBar . tooltip . appendMarkdown ( "\n\n---\n\n" ) ;
455
464
}
456
- statusBar . tooltip . appendMarkdown ( "\n\n[Open logs](command:rust-analyzer.openLogs)" ) ;
465
+ statusBar . tooltip . appendMarkdown ( "\n\n[Open Logs](command:rust-analyzer.openLogs)" ) ;
466
+ statusBar . tooltip . appendMarkdown (
467
+ `\n\n[${
468
+ this . config . checkOnSave ? "Disable" : "Enable"
469
+ } Check on Save](command:rust-analyzer.toggleCheckOnSave)`,
470
+ ) ;
457
471
statusBar . tooltip . appendMarkdown (
458
472
"\n\n[Reload Workspace](command:rust-analyzer.reloadWorkspace)" ,
459
473
) ;
0 commit comments