From ebbec3250c8de84d3bbaf0a4739cea2c710696ee Mon Sep 17 00:00:00 2001 From: Alessio Occhipinti Date: Mon, 13 Jan 2020 12:01:28 +0100 Subject: [PATCH] Fix/extension manager init (#442) * fix: remove init from constructor * fix: add extension manager init to activate --- src/core/extension-manager.ts | 4 ++-- src/material.theme.config.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/extension-manager.ts b/src/core/extension-manager.ts index ed2f110..6678458 100644 --- a/src/core/extension-manager.ts +++ b/src/core/extension-manager.ts @@ -14,6 +14,7 @@ type InstallationType = { }; export interface IExtensionManager { + init: () => Promise; getPackageJSON: () => Record; getConfig: () => MaterialThemeConfig; getInstallationType: () => {}; @@ -30,7 +31,6 @@ class ExtensionManager implements IExtensionManager { const extensionFolderUri = Uri.file(extensions.getExtension(MATERIAL_THEME_EXT_ID).extensionPath); this.configFileUri = extensionFolderUri.with({path: posix.join(extensionFolderUri.path, CONFIG_FILE_NAME)}); this.userConfigFileUri = extensionFolderUri.with({path: posix.join(extensionFolderUri.path, USER_CONFIG_FILE_NAME)}); - this.init(); } getPackageJSON(): Record { @@ -78,7 +78,7 @@ class ExtensionManager implements IExtensionManager { } catch {} } - private async init(): Promise { + async init(): Promise { try { const packageJSON = this.getPackageJSON(); const userConfig = await this.getUserConfig(); diff --git a/src/material.theme.config.ts b/src/material.theme.config.ts index 05ad5d4..4c5144a 100644 --- a/src/material.theme.config.ts +++ b/src/material.theme.config.ts @@ -9,6 +9,7 @@ import {changelogManager} from './core/changelog-manager'; import {extensionManager} from './core/extension-manager'; export async function activate(context: ExtensionContext): Promise { + await extensionManager.init(); const releaseNotesView = new ReleaseNotesWebview(context); const installationType = extensionManager.getInstallationType();