当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript languageFeatureRegistry.all函数代码示例

本文整理汇总了TypeScript中vs/editor/common/modes/languageFeatureRegistry.all函数的典型用法代码示例。如果您正苦于以下问题:TypeScript all函数的具体用法?TypeScript all怎么用?TypeScript all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了all函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getOutlineEntries

export function getOutlineEntries(model: IModel): TPromise<IOutline> {

	let groupLabels: { [n: string]: string } = Object.create(null);
	let entries: IOutlineEntry[] = [];

	let promises = OutlineRegistry.all(model).map(support => {

		if (support.outlineGroupLabel) {
			let keys = Object.keys(support.outlineGroupLabel);
			for (let i = 0, len = keys.length; i < len; i++) {
				let key = keys[i];
				groupLabels[key] = support.outlineGroupLabel[key];
			}
		}

		return support.getOutline(model.getAssociatedResource()).then(result => {
			if (Array.isArray(result)) {
				entries.push(...result);
			}
		}, err => {
			onUnexpectedError(err);
		});
	});

	return TPromise.join(promises).then(() => {
		let flatEntries: IOutlineEntry[] = [];
		flatten(flatEntries, entries, '');
		flatEntries.sort(compareEntriesUsingStart);

		return {
			entries: flatEntries,
			outlineGroupLabel: groupLabels
		};
	});
}
开发者ID:Contagious-Marketing,项目名称:vscode,代码行数:35,代码来源:quickOpen.ts

示例2: getOutlineEntries

export function getOutlineEntries(model: IModel): TPromise<IOutline> {

	let groupLabels: { [n: string]: string } = Object.create(null);
	let entries: IOutlineEntry[] = [];

	let promises = OutlineRegistry.all(model).map(support => {

		if (support.outlineGroupLabel) {
			for (var key in support.outlineGroupLabel) {
				if (Object.prototype.hasOwnProperty.call(support.outlineGroupLabel, key)) {
					groupLabels[key] = support.outlineGroupLabel[key];
				}
			}
		}

		return support.getOutline(model.getAssociatedResource()).then(result => {
			if (Array.isArray(result)) {
				entries.push(...result);
			}
		}, err => {
			onUnexpectedError(err);
		});
	});

	return TPromise.join(promises).then(() => {
		let flatEntries: IOutlineEntry[] = [];
		flatten(flatEntries, entries, '');
		flatEntries.sort(compareEntriesUsingStart);

		return {
			entries: flatEntries,
			outlineGroupLabel: groupLabels
		};
	});
}
开发者ID:578723746,项目名称:vscode,代码行数:35,代码来源:quickOpen.ts

示例3: getCodeLensData

export function getCodeLensData(model: IModel):TPromise<ICodeLensData[]> {

	const symbols: ICodeLensData[] = [];
	const promises = CodeLensRegistry.all(model).map(support => {
		return support.findCodeLensSymbols(model.getAssociatedResource()).then(result => {
			if (!Array.isArray(result)) {
				return;
			}
			for (let symbol of result) {
				symbols.push({ symbol, support });
			}
		}, err => {
			onUnexpectedError(err);
		});
	});

	return TPromise.join(promises).then(() => symbols);
}
开发者ID:sangohan,项目名称:KodeStudio,代码行数:18,代码来源:codelens.ts

示例4: getQuickFixes

export function getQuickFixes(model: IModel, range: IRange): TPromise<IQuickFix2[]> {

	const quickFixes: IQuickFix2[] = [];
	let idPool = 0;
	const promises = QuickFixRegistry.all(model).map(support => {
		return support.getQuickFixes(model.getAssociatedResource(), range).then(result => {
			if (!Array.isArray(result)) {
				return;
			}
			for (let fix of result) {
				quickFixes.push({
					command: fix.command,
					score: fix.score,
					id: `quickfix_#${idPool++}`,
					support
				});
			}
		}, err => {
			onUnexpectedError(err);
		});
	});

	return TPromise.join(promises).then(() => quickFixes);
}
开发者ID:1424667164,项目名称:vscode,代码行数:24,代码来源:quickFix.ts


注:本文中的vs/editor/common/modes/languageFeatureRegistry.all函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。