Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/accessibility/browser/accessibleViewRegistry.ts
3296 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 { IDisposable } from '../../../base/common/lifecycle.js';
7
import { AccessibleViewType, AccessibleContentProvider, ExtensionContentProvider } from './accessibleView.js';
8
import { ContextKeyExpression } from '../../contextkey/common/contextkey.js';
9
import { ServicesAccessor } from '../../instantiation/common/instantiation.js';
10
11
export interface IAccessibleViewImplementation {
12
type: AccessibleViewType;
13
priority: number;
14
name: string;
15
/**
16
* @returns the provider or undefined if the view should not be shown
17
*/
18
getProvider: (accessor: ServicesAccessor) => AccessibleContentProvider | ExtensionContentProvider | undefined;
19
when?: ContextKeyExpression | undefined;
20
}
21
22
export const AccessibleViewRegistry = new class AccessibleViewRegistry {
23
_implementations: IAccessibleViewImplementation[] = [];
24
25
register(implementation: IAccessibleViewImplementation): IDisposable {
26
this._implementations.push(implementation);
27
return {
28
dispose: () => {
29
const idx = this._implementations.indexOf(implementation);
30
if (idx !== -1) {
31
this._implementations.splice(idx, 1);
32
}
33
}
34
};
35
}
36
37
getImplementations(): IAccessibleViewImplementation[] {
38
return this._implementations;
39
}
40
};
41
42
43