File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -204,13 +204,13 @@ export class Ctx {
204204 }
205205 }
206206
207- setServerStatus ( status : ServerStatusParams ) {
207+ setServerStatus ( status : ServerStatusParams | { health : "stopped" } ) {
208208 let icon = "" ;
209209 const statusBar = this . statusBar ;
210210 switch ( status . health ) {
211211 case "ok" :
212- statusBar . tooltip = status . message ?? "Ready" ;
213- statusBar . command = undefined ;
212+ statusBar . tooltip = ( status . message ?? "Ready" ) + "Click to stop. ";
213+ statusBar . command = "rust-analyzer.stopServer" ;
214214 statusBar . color = undefined ;
215215 statusBar . backgroundColor = undefined ;
216216 break ;
@@ -234,6 +234,13 @@ export class Ctx {
234234 statusBar . backgroundColor = new vscode . ThemeColor ( "statusBarItem.errorBackground" ) ;
235235 icon = "$(error) " ;
236236 break ;
237+ case "stopped" :
238+ statusBar . tooltip = "Server is stopped. Click to start." ;
239+ statusBar . command = "rust-analyzer.startServer" ;
240+ statusBar . color = undefined ;
241+ statusBar . backgroundColor = undefined ;
242+ statusBar . text = `$(stop-circle) rust-analyzer` ;
243+ return ;
237244 }
238245 if ( ! status . quiescent ) icon = "$(sync~spin) " ;
239246 statusBar . text = `${ icon } rust-analyzer` ;
Original file line number Diff line number Diff line change @@ -120,9 +120,7 @@ function createCommands(): Record<string, CommandFactory> {
120120 // FIXME: We should re-use the client, that is ctx.deactivate() if none of the configs have changed
121121 await ctx . stop ( ) ;
122122 ctx . setServerStatus ( {
123- health : "ok" ,
124- quiescent : true ,
125- message : "server is not running" ,
123+ health : "stopped" ,
126124 } ) ;
127125 } ,
128126 } ,
You can’t perform that action at this time.
0 commit comments