@@ -3,6 +3,7 @@ import { StatusBarItem, ThemeColor } from "vscode";
3
3
export interface StatusBarConfig {
4
4
text : string ;
5
5
color : string ;
6
+ command ?: string ;
6
7
}
7
8
8
9
export enum StatusBarStatus {
@@ -21,39 +22,40 @@ export function getStatusBarConfig(status: StatusBarStatus): StatusBarConfig {
21
22
return {
22
23
text : "GitGuardian - Initializing..." ,
23
24
color : "statusBar.foreground" ,
24
- // TODO: onclick open output channel if the bar is frozen and I want to see what's going on
25
+ command : "gitguardian.showOutput" ,
25
26
} ;
26
27
case StatusBarStatus . unauthenticated :
27
28
return {
28
29
text : "GitGuardian - Please authenticate" ,
29
30
color : "statusBarItem.warningBackground" ,
30
- // TODO: onclick open sidebar
31
+ command : "gitguardian.openSidebar" ,
31
32
} ;
32
33
case StatusBarStatus . ready :
33
34
return { text : "GitGuardian is ready" , color : "statusBar.foreground" } ;
34
35
case StatusBarStatus . scanning :
35
36
return {
36
37
text : "GitGuardian - Scanning..." ,
37
38
color : "statusBar.foreground" ,
38
- // TODO: onclick open output channel if the bar is frozen and I want to see what's going on
39
+ command : "gitguardian.showOutput" ,
39
40
} ;
40
41
case StatusBarStatus . secretFound :
41
42
return {
42
43
text : "GitGuardian - Secret found" ,
43
44
color : "statusBarItem.errorBackground" ,
45
+ command : "gitguardian.openProblems" ,
44
46
// TODO: onclick open problems panel
45
47
} ;
46
48
case StatusBarStatus . noSecretFound :
47
49
return {
48
50
text : "GitGuardian - No secret found" ,
49
51
color : "statusBar.foreground" ,
50
- // TODO: onclick open sidebar
52
+ command : "gitguardian.openSidebar" ,
51
53
} ;
52
54
case StatusBarStatus . error :
53
55
return {
54
56
text : "GitGuardian - error" ,
55
57
color : "statusBarItem.errorBackground" ,
56
- // TODO: onclick open output channel panel
58
+ command : "gitguardian.showOutput" ,
57
59
} ;
58
60
default :
59
61
return { text : "" , color : "statusBar.foreground" } ;
@@ -68,5 +70,12 @@ export function updateStatusBarItem(
68
70
statusBarItem . text = config . text ;
69
71
statusBarItem . backgroundColor = new ThemeColor ( config . color ) ;
70
72
73
+ // If the command is defined, assign it to the status bar item
74
+ if ( config . command ) {
75
+ statusBarItem . command = config . command ;
76
+ } else {
77
+ statusBarItem . command = undefined ;
78
+ }
79
+
71
80
statusBarItem . show ( ) ;
72
81
}
0 commit comments