@@ -15,31 +15,31 @@ export default createPlugin(
1515 } ) => {
1616 context . subscriptions . push (
1717 commands . registerCommand ( "localstack.showCommands" , async ( ) => {
18- const shouldShowLocalStackStart = async ( ) =>
19- ( await checkLocalstackInstalled ( outputChannel ) ) &&
18+ const shouldShowLocalStackStart = ( ) =>
19+ setupStatusTracker . statuses ( ) . isInstalled &&
2020 localStackStatusTracker . status ( ) === "stopped" ;
21- const shouldShowLocalStackStop = async ( ) =>
22- ( await checkLocalstackInstalled ( outputChannel ) ) &&
21+ const shouldShowLocalStackStop = ( ) =>
22+ setupStatusTracker . statuses ( ) . isInstalled &&
2323 localStackStatusTracker . status ( ) === "running" ;
2424 const shouldShowRunSetupWizard = ( ) =>
2525 setupStatusTracker . status ( ) === "setup_required" ;
2626
27- const getCommands = async ( ) => {
27+ const getCommands = ( ) => {
2828 const commands : ( QuickPickItem & { command : string } ) [ ] = [ ] ;
2929 commands . push ( {
3030 label : "Manage" ,
3131 command : "" ,
3232 kind : QuickPickItemKind . Separator ,
3333 } ) ;
3434
35- if ( await shouldShowLocalStackStart ( ) ) {
35+ if ( shouldShowLocalStackStart ( ) ) {
3636 commands . push ( {
3737 label : "Start LocalStack" ,
3838 command : "localstack.start" ,
3939 } ) ;
4040 }
4141
42- if ( await shouldShowLocalStackStop ( ) ) {
42+ if ( shouldShowLocalStackStop ( ) ) {
4343 commands . push ( {
4444 label : "Stop LocalStack" ,
4545 command : "localstack.stop" ,
@@ -59,7 +59,7 @@ export default createPlugin(
5959
6060 if ( shouldShowRunSetupWizard ( ) ) {
6161 commands . push ( {
62- label : "Run LocalStack setup Wizard" ,
62+ label : "Run LocalStack Setup Wizard" ,
6363 command : "localstack.setup" ,
6464 } ) ;
6565 }
@@ -81,30 +81,30 @@ export default createPlugin(
8181 commands . registerCommand ( "localstack.refreshStatusBar" , ( ) => {
8282 // TODO
8383 const setupStatus = setupStatusTracker . status ( ) ;
84-
85- if ( setupStatus === "setup_required" ) {
86- statusBarItem . command = "localstack.showCommands" ;
87- statusBarItem . text = "$(error) LocalStack " ;
88- statusBarItem . backgroundColor = new ThemeColor (
89- "statusBarItem.errorBackground" ,
90- ) ;
91- } else {
92- statusBarItem . command = "localstack.showCommands" ;
93- statusBarItem . backgroundColor = undefined ;
94- const localStackStatus = localStackStatusTracker . status ( ) ;
95- if (
96- localStackStatus === "starting" ||
97- localStackStatus === "stopping "
98- ) {
99- statusBarItem . text = ` $(sync~spin) LocalStack ( ${ localStackStatus } )` ;
100- } else if (
101- localStackStatus === "running" ||
102- localStackStatus === "stopped"
103- ) {
104- statusBarItem . text = `$(localstack-logo) LocalStack ( ${ localStackStatus } )` ;
105- }
106- }
107-
84+ const localStackStatus = localStackStatusTracker . status ( ) ;
85+ const localStackInstalled = setupStatusTracker . statuses ( ) . isInstalled ;
86+
87+ statusBarItem . command = "localstack.showCommands " ;
88+ statusBarItem . backgroundColor =
89+ setupStatus === "setup_required"
90+ ? new ThemeColor ( "statusBarItem.errorBackground" )
91+ : undefined ;
92+
93+ const shouldSpin =
94+ localStackStatus === "starting" || localStackStatus === "stopping" ;
95+ const icon =
96+ setupStatus === "setup_required"
97+ ? "$(error) "
98+ : shouldSpin
99+ ? " $(sync~spin)"
100+ : "$(localstack-logo)" ;
101+
102+ const statusText = localStackInstalled
103+ ? ` ${ localStackStatus } `
104+ : "not installed" ;
105+ statusBarItem . text = ` ${ icon } LocalStack: ${ statusText } ` ;
106+
107+ statusBarItem . tooltip = "Show LocalStack commands" ;
108108 statusBarItem . show ( ) ;
109109 } ) ,
110110 ) ;
@@ -118,6 +118,7 @@ export default createPlugin(
118118 } ) ;
119119 }
120120 } ;
121+
121122 context . subscriptions . push ( {
122123 dispose ( ) {
123124 clearImmediate ( refreshStatusBarImmediateId ) ;
@@ -127,10 +128,12 @@ export default createPlugin(
127128 refreshStatusBarImmediate ( ) ;
128129
129130 localStackStatusTracker . onChange ( ( ) => {
131+ outputChannel . trace ( "[status-bar]: localStackStatusTracker changed" ) ;
130132 refreshStatusBarImmediate ( ) ;
131133 } ) ;
132134
133135 setupStatusTracker . onChange ( ( ) => {
136+ outputChannel . trace ( "[status-bar]: setupStatusTracker changed" ) ;
134137 refreshStatusBarImmediate ( ) ;
135138 } ) ;
136139 } ,
0 commit comments