Fix/extension manager init (#442)

* fix: remove init from constructor

* fix: add extension manager init to activate
This commit is contained in:
Alessio Occhipinti 2020-01-13 12:01:28 +01:00 committed by Mattia Astorino
parent 68b1afe566
commit ebbec3250c
2 changed files with 3 additions and 2 deletions

View file

@ -14,6 +14,7 @@ type InstallationType = {
}; };
export interface IExtensionManager { export interface IExtensionManager {
init: () => Promise<void>;
getPackageJSON: () => Record<string, any>; getPackageJSON: () => Record<string, any>;
getConfig: () => MaterialThemeConfig; getConfig: () => MaterialThemeConfig;
getInstallationType: () => {}; getInstallationType: () => {};
@ -30,7 +31,6 @@ class ExtensionManager implements IExtensionManager {
const extensionFolderUri = Uri.file(extensions.getExtension(MATERIAL_THEME_EXT_ID).extensionPath); const extensionFolderUri = Uri.file(extensions.getExtension(MATERIAL_THEME_EXT_ID).extensionPath);
this.configFileUri = extensionFolderUri.with({path: posix.join(extensionFolderUri.path, CONFIG_FILE_NAME)}); 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.userConfigFileUri = extensionFolderUri.with({path: posix.join(extensionFolderUri.path, USER_CONFIG_FILE_NAME)});
this.init();
} }
getPackageJSON(): Record<string, any> { getPackageJSON(): Record<string, any> {
@ -78,7 +78,7 @@ class ExtensionManager implements IExtensionManager {
} catch {} } catch {}
} }
private async init(): Promise<void> { async init(): Promise<void> {
try { try {
const packageJSON = this.getPackageJSON(); const packageJSON = this.getPackageJSON();
const userConfig = await this.getUserConfig(); const userConfig = await this.getUserConfig();

View file

@ -9,6 +9,7 @@ import {changelogManager} from './core/changelog-manager';
import {extensionManager} from './core/extension-manager'; import {extensionManager} from './core/extension-manager';
export async function activate(context: ExtensionContext): Promise<void> { export async function activate(context: ExtensionContext): Promise<void> {
await extensionManager.init();
const releaseNotesView = new ReleaseNotesWebview(context); const releaseNotesView = new ReleaseNotesWebview(context);
const installationType = extensionManager.getInstallationType(); const installationType = extensionManager.getInstallationType();