src/vs/platform/registry/common/platform.ts
63 LOC · 56 covered · 7 uncovered · 8 ranges · 8483 concepts · 4 introducers · 4435 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
/*---------------------------------------------------------------------------------------------
platform.ts ×5
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as Assert from '../../../base/common/assert.js';
import * as Types from '../../../base/common/types.js';
export interface IRegistry {
/**
* Adds the extension functions and properties defined by data to the
* platform. The provided id must be unique.
* @param id a unique identifier
* @param data a contribution
*/
add(id: string, data: any): void;
/**
* Returns true iff there is an extension with the provided id.
* @param id an extension identifier
*/
knows(id: string): boolean;
/**
* Returns the extension functions and properties defined by the specified key or null.
* @param id an extension identifier
*/
as<T>(id: string): T;
}
class RegistryImpl implements IRegistry {
private readonly data = new Map<string, any>();
public add(id: string, data: any): void {
Assert.ok(Types.isObject(data));
Assert.ok(!this.data.has(id), 'There is already an extension with this id');
this.data.set(id, data);
}
public knows(id: string): boolean {
}
public as(id: string): any {
}
public dispose() {
this.data.forEach((value) => {
if (Types.isFunction(value.dispose)) {
value.dispose();
}
});
this.data.clear();
}
}
export const Registry: IRegistry = new RegistryImpl();