"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SnippetsContributionPoint = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const monaco_snippet_suggest_provider_1 = require("@opensumi/ide-monaco/lib/browser/monaco-snippet-suggest-provider");
const common_1 = require("../../../common");
const types_1 = require("../../types");
let SnippetsContributionPoint = class SnippetsContributionPoint extends common_1.VSCodeContributePoint {
    contribute() {
        for (const contrib of this.contributesMap) {
            const { extensionId, contributes } = contrib;
            const extension = this.extensionManageService.getExtensionInstanceByExtId(extensionId);
            if (!extension) {
                continue;
            }
            for (const snippet of contributes) {
                this.addDispose(this.snippetSuggestProvider.fromPath(snippet.path, {
                    extPath: extension.path,
                    language: snippet.language,
                    source: extension.packageJSON.name,
                }));
            }
        }
        this.addDispose(this.snippetSuggestProvider.registerSnippetsProvider());
    }
};
exports.SnippetsContributionPoint = SnippetsContributionPoint;
tslib_1.__decorate([
    (0, di_1.Autowired)(monaco_snippet_suggest_provider_1.MonacoSnippetSuggestProvider),
    tslib_1.__metadata("design:type", monaco_snippet_suggest_provider_1.MonacoSnippetSuggestProvider)
], SnippetsContributionPoint.prototype, "snippetSuggestProvider", void 0);
tslib_1.__decorate([
    (0, di_1.Autowired)(types_1.AbstractExtInstanceManagementService),
    tslib_1.__metadata("design:type", types_1.AbstractExtInstanceManagementService)
], SnippetsContributionPoint.prototype, "extensionManageService", void 0);
exports.SnippetsContributionPoint = SnippetsContributionPoint = tslib_1.__decorate([
    (0, di_1.Injectable)(),
    (0, common_1.Contributes)('snippets'),
    (0, common_1.LifeCycle)(4 /* LifeCyclePhase.Ready */)
], SnippetsContributionPoint);
//# sourceMappingURL=snippets.js.map