Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/common/editorFeatures.ts
3292 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { BrandedService, IConstructorSignature } from '../../platform/instantiation/common/instantiation.js';
7
8
/**
9
* A feature that will be loaded when the first code editor is constructed and disposed when the system shuts down.
10
*/
11
export interface IEditorFeature {
12
// Marker Interface
13
}
14
15
export type EditorFeatureCtor = IConstructorSignature<IEditorFeature>;
16
17
const editorFeatures: EditorFeatureCtor[] = [];
18
19
/**
20
* Registers an editor feature. Editor features will be instantiated only once, as soon as
21
* the first code editor is instantiated.
22
*/
23
export function registerEditorFeature<Services extends BrandedService[]>(ctor: { new(...services: Services): IEditorFeature }): void {
24
editorFeatures.push(ctor as EditorFeatureCtor);
25
}
26
27
export function getEditorFeatures(): Iterable<EditorFeatureCtor> {
28
return editorFeatures.slice(0);
29
}
30
31