Path: blob/main/src/vs/editor/common/editorFeatures.ts
3292 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { BrandedService, IConstructorSignature } from '../../platform/instantiation/common/instantiation.js';67/**8* A feature that will be loaded when the first code editor is constructed and disposed when the system shuts down.9*/10export interface IEditorFeature {11// Marker Interface12}1314export type EditorFeatureCtor = IConstructorSignature<IEditorFeature>;1516const editorFeatures: EditorFeatureCtor[] = [];1718/**19* Registers an editor feature. Editor features will be instantiated only once, as soon as20* the first code editor is instantiated.21*/22export function registerEditorFeature<Services extends BrandedService[]>(ctor: { new(...services: Services): IEditorFeature }): void {23editorFeatures.push(ctor as EditorFeatureCtor);24}2526export function getEditorFeatures(): Iterable<EditorFeatureCtor> {27return editorFeatures.slice(0);28}293031