From 8c8b95016a2a47d60b0db960539b0c5f34609701 Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Thu, 17 Feb 2022 22:56:47 +0100 Subject: [PATCH] Delay and wait for loadConfigs() after logging version info --- CHANGELOG.md | 2 ++ src/config.ts | 1 - src/extension.ts | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d22af..62ffb38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Changes - Small improvements to Dropdown(WithInput) UI components +- Delay and wait for loadConfigs() after logging version info + - This solves a small issue/annoyance where logs regarding loading logs appear before the version logging ### Development changes - Added `semver` as dependency in preparation of `FS_NOTIFY_ERRORS` flag diff --git a/src/config.ts b/src/config.ts index f8ed405..d321173 100644 --- a/src/config.ts +++ b/src/config.ts @@ -342,7 +342,6 @@ vscode.workspace.onDidChangeConfiguration(async (e) => { // if (!e.affectsConfiguration('sshfs.configs')) return; return loadConfigs(); }); -loadConfigs(); function parseFlagList(list: string[] | undefined, origin: string): Record { if (list === undefined) return {}; diff --git a/src/extension.ts b/src/extension.ts index ac05351..b312934 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -26,8 +26,9 @@ interface CommandHandler { handleTerminal?(terminal: SSHPseudoTerminal): void; } -export function activate(context: vscode.ExtensionContext) { +export async function activate(context: vscode.ExtensionContext) { Logging.info`Extension activated, version ${getVersion()}, mode ${context.extensionMode}`; + Logging.debug`Running VS Code version ${vscode.version} ${process.versions}`; setDebug(process.env.VSCODE_SSHFS_DEBUG?.toLowerCase() === 'true'); @@ -46,6 +47,11 @@ export function activate(context: vscode.ExtensionContext) { // I really don't like having to pass context to *everything*, so let's do it this way setAsAbsolutePath(context.asAbsolutePath.bind(context)); + // Start loading the configs (asynchronously) + try { await loadConfigs() } catch (e) { + Logging.error`Could not load configs: ${e}`; + } + const manager = new Manager(context); const subscribe = context.subscriptions.push.bind(context.subscriptions) as typeof context.subscriptions.push;