mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 10:58:31 -05:00
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
'use strict';
|
|
|
|
import { Registry } from 'vs/platform/registry/common/platform';
|
|
import { IEditorContributionCtor } from 'vs/editor/browser/editorBrowser';
|
|
|
|
export function editorContribution(ctor: IEditorContributionCtor): void {
|
|
EditorContributionRegistry.INSTANCE.registerEditorBrowserContribution(ctor);
|
|
}
|
|
|
|
export namespace EditorBrowserRegistry {
|
|
export function getEditorContributions(): IEditorContributionCtor[] {
|
|
return EditorContributionRegistry.INSTANCE.getEditorBrowserContributions();
|
|
}
|
|
}
|
|
|
|
const Extensions = {
|
|
EditorContributions: 'editor.contributions'
|
|
};
|
|
|
|
class EditorContributionRegistry {
|
|
|
|
public static INSTANCE = new EditorContributionRegistry();
|
|
|
|
private editorContributions: IEditorContributionCtor[];
|
|
|
|
constructor() {
|
|
this.editorContributions = [];
|
|
}
|
|
|
|
public registerEditorBrowserContribution(ctor: IEditorContributionCtor): void {
|
|
this.editorContributions.push(ctor);
|
|
}
|
|
|
|
public getEditorBrowserContributions(): IEditorContributionCtor[] {
|
|
return this.editorContributions.slice(0);
|
|
}
|
|
}
|
|
|
|
Registry.add(Extensions.EditorContributions, EditorContributionRegistry.INSTANCE);
|