import { __decorate, __metadata } from "tslib";
import { IPluginService } from '@codeblitzjs/ide-plugin';
import { Autowired, Injectable } from '@opensumi/di';
import { BrowserModule } from '@opensumi/ide-core-browser';
import { IExtensionStorageService } from '@opensumi/ide-extension-storage';
import { ExtensionServiceImpl } from '@opensumi/ide-extension/lib/browser/extension.service';
import { ExtensionService } from '@opensumi/ide-extension/lib/common';
import { ExtensionActivateContribution } from '../extension/extension.contribution';
let ExtensionServiceImplOverride = class ExtensionServiceImplOverride extends ExtensionServiceImpl {
    async activate() {
        await this.extensionStorageServiceOverride.whenReady;
        await this.lazyActivate();
        return Promise.resolve();
    }
    /**
     * 不阻塞启动
     * TODO: 目前使用私有属性，待升级后改造
     */
    async lazyActivate() {
        await this.initExtensionMetaData();
        await this.initExtensionInstanceData();
        await this.runEagerExtensionsContributes();
        await this.runExtensionContributes();
        await this.setupExtensionNLSConfig();
        this.doActivate();
        // 无需监听插件重启
    }
};
__decorate([
    Autowired(IPluginService),
    __metadata("design:type", Object)
], ExtensionServiceImplOverride.prototype, "pluginService", void 0);
__decorate([
    Autowired(IExtensionStorageService),
    __metadata("design:type", Object)
], ExtensionServiceImplOverride.prototype, "extensionStorageServiceOverride", void 0);
ExtensionServiceImplOverride = __decorate([
    Injectable()
], ExtensionServiceImplOverride);
let ExtensionActivateModule = class ExtensionActivateModule extends BrowserModule {
    constructor() {
        super(...arguments);
        this.providers = [
            {
                token: ExtensionService,
                useClass: ExtensionServiceImplOverride,
                override: true,
            },
            ExtensionActivateContribution,
        ];
    }
};
ExtensionActivateModule = __decorate([
    Injectable()
], ExtensionActivateModule);
export { ExtensionActivateModule };
//# sourceMappingURL=editor.extension.js.map