Skip to content

Commit b94d539

Browse files
committed
Use an object instead of an array.
1 parent 5b4eb15 commit b94d539

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

editors/vscode/client/extension.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,18 @@ export async function deactivate(): Promise<void> {
312312

313313
/**
314314
* Get the status bar state based on whether oxc is enabled and allowed to start.
315-
* @returns Returns an array of valid ThemeColor id, icon, and tooltip text for the status bar item.
316315
*/
317-
function getStatusBarState(enable: boolean) {
316+
function getStatusBarState(enable: boolean): { bgColor: string; icon: string; tooltipText: string } {
318317
if (!allowedToStartServer) {
319-
return ['statusBarItem.offlineBackground', 'circle-slash', 'oxc is disabled (no .oxlintrc.json found)'];
318+
return {
319+
bgColor: 'statusBarItem.offlineBackground',
320+
icon: 'circle-slash',
321+
tooltipText: 'oxc is disabled (no .oxlintrc.json found)',
322+
};
320323
} else if (!enable) {
321-
return ['statusBarItem.warningBackground', 'check', 'oxc is disabled'];
324+
return { bgColor: 'statusBarItem.warningBackground', icon: 'check', tooltipText: 'oxc is disabled' };
322325
} else {
323-
return ['statusBarItem.activeBackground', 'check-all', 'oxc is enabled'];
326+
return { bgColor: 'statusBarItem.activeBackground', icon: 'check-all', tooltipText: 'oxc is enabled' };
324327
}
325328
}
326329

@@ -332,7 +335,7 @@ function updateStatusBar(context: ExtensionContext, enable: boolean) {
332335
oxcStatusBarItem.show();
333336
}
334337

335-
const [bgColor, icon, tooltipText] = getStatusBarState(enable);
338+
const { bgColor, icon, tooltipText } = getStatusBarState(enable);
336339

337340
oxcStatusBarItem.text = `$(${icon}) oxc`;
338341
oxcStatusBarItem.backgroundColor = new ThemeColor(bgColor);

0 commit comments

Comments
 (0)