123456789101112131415161718192021222324252627282930 |
- /*---------------------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
- import { Emitter } from '../../../base/common/event.js';
- import * as platform from '../../registry/common/platform.js';
- export const Extensions = {
- JSONContribution: 'base.contributions.json'
- };
- function normalizeId(id) {
- if (id.length > 0 && id.charAt(id.length - 1) === '#') {
- return id.substring(0, id.length - 1);
- }
- return id;
- }
- class JSONContributionRegistry {
- constructor() {
- this._onDidChangeSchema = new Emitter();
- this.schemasById = {};
- }
- registerSchema(uri, unresolvedSchemaContent) {
- this.schemasById[normalizeId(uri)] = unresolvedSchemaContent;
- this._onDidChangeSchema.fire(uri);
- }
- notifySchemaChanged(uri) {
- this._onDidChangeSchema.fire(uri);
- }
- }
- const jsonContributionRegistry = new JSONContributionRegistry();
- platform.Registry.add(Extensions.JSONContribution, jsonContributionRegistry);
|