export const SyncStatus = defineStatusBarItem({
id: 'sample.syncStatus',
text: '$(cloud) Idle',
command: 'sample.sync',
});
module.statusBar.add(SyncStatus);
module.commands.handle(Sync, {
inject: { status: SyncStatus.token },
execute: async (context, _args, { status }) => {
status.setBusy(true);
try {
await doSync(context.signal);
status.update('$(check) Synced');
} finally {
status.setBusy(false);
}
},
});
Declares a status bar item as part of the application model.
The item is created when the application activates — visible immediately, without anything having to inject it first — and disposed when the application stops. Handlers inject the controller under
definition.tokento update it.