mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
feat: Clicking the status bar item stops and starts the server
This commit is contained in:
parent
d022e0ec53
commit
274df54885
2 changed files with 11 additions and 6 deletions
|
@ -204,13 +204,13 @@ export class Ctx {
|
|||
}
|
||||
}
|
||||
|
||||
setServerStatus(status: ServerStatusParams) {
|
||||
setServerStatus(status: ServerStatusParams | { health: "stopped" }) {
|
||||
let icon = "";
|
||||
const statusBar = this.statusBar;
|
||||
switch (status.health) {
|
||||
case "ok":
|
||||
statusBar.tooltip = status.message ?? "Ready";
|
||||
statusBar.command = undefined;
|
||||
statusBar.tooltip = (status.message ?? "Ready") + "Click to stop.";
|
||||
statusBar.command = "rust-analyzer.stopServer";
|
||||
statusBar.color = undefined;
|
||||
statusBar.backgroundColor = undefined;
|
||||
break;
|
||||
|
@ -234,6 +234,13 @@ export class Ctx {
|
|||
statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground");
|
||||
icon = "$(error) ";
|
||||
break;
|
||||
case "stopped":
|
||||
statusBar.tooltip = "Server is stopped. Click to start.";
|
||||
statusBar.command = "rust-analyzer.startServer";
|
||||
statusBar.color = undefined;
|
||||
statusBar.backgroundColor = undefined;
|
||||
statusBar.text = `$(stop-circle) rust-analyzer`;
|
||||
return;
|
||||
}
|
||||
if (!status.quiescent) icon = "$(sync~spin) ";
|
||||
statusBar.text = `${icon}rust-analyzer`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue