Skip to content

Commit 028cf85

Browse files
committed
fix: only sign in after command
- Command waits for setup to finish
1 parent d35c87e commit 028cf85

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

client/src/addon_manager/registration.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ dayjs.extend(RelativeTime);
1313

1414
/** Set up the addon manager by registering its commands in VS Code */
1515
export async function activate(context: vscode.ExtensionContext) {
16+
const setupPromises = [];
1617
// Register commands
1718
context.subscriptions.push(
1819
vscode.commands.registerCommand("lua.addon_manager.open", () => {
19-
credentials.login().then(() => {
20-
WebVue.render(context);
20+
Promise.allSettled(setupPromises).then(() => {
21+
credentials.login().then(() => {
22+
WebVue.render(context);
23+
});
2124
});
2225
})
2326
);
2427
// Create log file transport and add to logger
2528
const fileLogger = new VSCodeLogFileTransport(context.logUri, {
2629
level: "debug",
2730
});
28-
context.subscriptions.push(await fileLogger.init());
31+
const promiseFilelogger = await fileLogger.init();
32+
setupPromises.push(promiseFilelogger);
33+
context.subscriptions.push(promiseFilelogger);
2934
logger.add(fileLogger);
3035
fileLogger.logStart();
3136

@@ -35,8 +40,9 @@ export async function activate(context: vscode.ExtensionContext) {
3540
extensionStorageURI,
3641
ADDONS_DIRECTORY
3742
);
38-
await filesystem.createDirectory(addonDirectoryURI);
3943

40-
await credentials.initialize(context);
41-
await credentials.login();
44+
setupPromises.push(
45+
await filesystem.createDirectory(addonDirectoryURI),
46+
await credentials.initialize(context)
47+
);
4248
}

0 commit comments

Comments
 (0)