本文整理汇总了TypeScript中vs/platform/extensions/common/extensions.ExtensionIdentifier类的典型用法代码示例。如果您正苦于以下问题:TypeScript ExtensionIdentifier类的具体用法?TypeScript ExtensionIdentifier怎么用?TypeScript ExtensionIdentifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensionIdentifier类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _initialize
private _initialize(): void {
this._extensionsMap = new Map<string, IExtensionDescription>();
this._extensionsArr = [];
this._activationMap = new Map<string, IExtensionDescription[]>();
for (const extensionDescription of this._extensionDescriptions) {
if (this._extensionsMap.has(ExtensionIdentifier.toKey(extensionDescription.identifier))) {
// No overwriting allowed!
console.error('Extension `' + extensionDescription.identifier.value + '` is already registered');
continue;
}
this._extensionsMap.set(ExtensionIdentifier.toKey(extensionDescription.identifier), extensionDescription);
this._extensionsArr.push(extensionDescription);
if (Array.isArray(extensionDescription.activationEvents)) {
for (let activationEvent of extensionDescription.activationEvents) {
// TODO@joao: there's no easy way to contribute this
if (activationEvent === 'onUri') {
activationEvent = `onUri:${ExtensionIdentifier.toKey(extensionDescription.identifier)}`;
}
if (!this._activationMap.has(activationEvent)) {
this._activationMap.set(activationEvent, []);
}
this._activationMap.get(activationEvent)!.push(extensionDescription);
}
}
}
}
示例2: getRealAndSyntheticDocumentFormattersOrdered
export function getRealAndSyntheticDocumentFormattersOrdered(model: ITextModel): DocumentFormattingEditProvider[] {
const result: DocumentFormattingEditProvider[] = [];
const seen = new Set<string>();
// (1) add all document formatter
const docFormatter = DocumentFormattingEditProviderRegistry.ordered(model);
for (const formatter of docFormatter) {
result.push(formatter);
if (formatter.extensionId) {
seen.add(ExtensionIdentifier.toKey(formatter.extensionId));
}
}
// (2) add all range formatter as document formatter (unless the same extension already did that)
const rangeFormatter = DocumentRangeFormattingEditProviderRegistry.ordered(model);
for (const formatter of rangeFormatter) {
if (formatter.extensionId) {
if (seen.has(ExtensionIdentifier.toKey(formatter.extensionId))) {
continue;
}
seen.add(ExtensionIdentifier.toKey(formatter.extensionId));
}
result.push({
displayName: formatter.displayName,
extensionId: formatter.extensionId,
provideDocumentFormattingEdits(model, options, token) {
return formatter.provideDocumentRangeFormattingEdits(model, model.getFullModelRange(), options, token);
}
});
}
return result;
}
示例3:
private static _toSet<T>(arr: IExtensionPointUser<T>[]): Set<string> {
const result = new Set<string>();
for (let i = 0, len = arr.length; i < len; i++) {
result.add(ExtensionIdentifier.toKey(arr[i].description.identifier));
}
return result;
}
示例4: getExtensionDescription
public getExtensionDescription(extensionId: ExtensionIdentifier | string): IExtensionDescription | null {
const extension = this._extensionsMap.get(ExtensionIdentifier.toKey(extensionId));
return extension ? extension : null;
}
示例5:
this._extensionDescriptions = this._extensionDescriptions.filter(extension => !toRemoveSet.has(ExtensionIdentifier.toKey(extension.identifier)));