當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。