本文整理汇总了TypeScript中vs/editor/common/modes/modesRegistry.ModesRegistry.getLanguages方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ModesRegistry.getLanguages方法的具体用法?TypeScript ModesRegistry.getLanguages怎么用?TypeScript ModesRegistry.getLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/modes/modesRegistry.ModesRegistry
的用法示例。
在下文中一共展示了ModesRegistry.getLanguages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(useModesRegistry = true) {
this._nextLanguageId = 1;
this._languages = {};
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
this._languageIds = [];
if (useModesRegistry) {
this._registerLanguages(ModesRegistry.getLanguages());
ModesRegistry.onDidAddLanguages((m) => this._registerLanguages(m));
}
}
示例2: _registerLanguages
_registerLanguages(desc: ILanguageExtensionPoint[]): void {
if (desc.length === 0) {
return;
}
for (let i = 0; i < desc.length; i++) {
this._registerLanguage(desc[i]);
}
// Rebuild fast path maps
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
Object.keys(this._languages).forEach((langId) => {
let language = this._languages[langId];
if (language.name) {
this._nameMap[language.name] = language.identifier;
}
language.aliases.forEach((alias) => {
this._lowercaseNameMap[alias.toLowerCase()] = language.identifier;
});
language.mimetypes.forEach((mimetype) => {
this._mimeTypesMap[mimetype] = language.identifier;
});
});
Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerOverrideIdentifiers(ModesRegistry.getLanguages().map(language => language.id));
}
示例3: getLanguages
export function getLanguages(): ILanguageExtensionPoint[] {
let result: ILanguageExtensionPoint[] = [];
result = result.concat(ModesRegistry.getLanguages());
return result;
}