Skip to content

Commit

Permalink
Make status bar item use error foreground if CLI unavailable (#2587)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored Oct 14, 2022
1 parent 1e309c9 commit 58d8775
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion extension/src/status.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StatusBarItem, window } from 'vscode'
import { StatusBarItem, ThemeColor, window } from 'vscode'
import { Disposable } from './class/dispose'
import { ICli } from './cli'
import { RegisteredCommands } from './commands/external'
Expand Down Expand Up @@ -51,6 +51,8 @@ export class Status extends Disposable {

private setState = (isWorking: boolean) => {
this.statusBarItem.text = this.getText(isWorking)
this.statusBarItem.color = this.getColor()

this.statusBarItem.command = this.getCommand()
}

Expand All @@ -66,6 +68,13 @@ export class Status extends Disposable {
}
}

private getColor() {
if (this.available) {
return
}
return new ThemeColor('errorForeground')
}

private getCommand() {
if (this.available) {
return
Expand Down

0 comments on commit 58d8775

Please sign in to comment.