當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript async.toThenable函數代碼示例

本文整理匯總了TypeScript中vs/base/common/async.toThenable函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript toThenable函數的具體用法?TypeScript toThenable怎麽用?TypeScript toThenable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了toThenable函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: provideSignatureHelp

export function provideSignatureHelp(model:IModel, position:IEditorPosition, cancellationToken = CancellationToken.None): Thenable<SignatureHelp> {

	let support = SignatureHelpProviderRegistry.ordered(model)[0];
	if (!support) {
		return TPromise.as(undefined);
	}

	return toThenable(support.provideSignatureHelp(model, position, cancellationToken));
}
開發者ID:Newtex,項目名稱:vscode,代碼行數:9,代碼來源:parameterHints.ts

示例2: computeDiff

export function computeDiff(oneDocument: vscode.TextDocument, otherDocument: vscode.TextDocument): Thenable<vscode.LineChange[]> {
	const oneLines = getTextDocumentLines(oneDocument);
	const otherLines = getTextDocumentLines(otherDocument);
	const computer = new DiffComputer(oneLines, otherLines, {
		shouldPostProcessCharChanges: false,
		shouldIgnoreTrimWhitespace: false, // options?
		shouldConsiderTrimWhitespaceInEmptyCase: false
	});

	return toThenable(computer.computeDiff());
}
開發者ID:yuit,項目名稱:vscode,代碼行數:11,代碼來源:extHostFunctions.ts

示例3: toThenable

	const promises = supports.map((support, idx) => {
		return toThenable(support.provideHover(model, position, cancellationToken)).then(result => {
			if (result) {
				let hasRange = (typeof result.range !== 'undefined');
				let hasHtmlContent = (typeof result.htmlContent !== 'undefined' && result.htmlContent && result.htmlContent.length > 0);
				if (hasRange && hasHtmlContent) {
					values[idx]  = result;
				}
			}
		}, err => {
			onUnexpectedError(err);
		});
	});
開發者ID:ccding-ustc,項目名稱:vscode,代碼行數:13,代碼來源:hover.ts

示例4: toThenable

	let promises = providers.map((provider, i) => {
		return toThenable(provider.provideFoldingRanges(model, foldingContext, cancellationToken)).then(ranges => {
			if (cancellationToken.isCancellationRequested) {
				return;
			}
			if (Array.isArray(ranges)) {
				if (!Array.isArray(rangeData)) {
					rangeData = [];
				}
				let nLines = model.getLineCount();
				for (let r of ranges) {
					if (r.start > 0 && r.end > r.start && r.end <= nLines) {
						rangeData.push({ start: r.start, end: r.end, rank: i, kind: r.kind });
					}
				}
			}
		}, onUnexpectedExternalError);
	});
開發者ID:AllureFer,項目名稱:vscode,代碼行數:18,代碼來源:syntaxRangeProvider.ts

示例5: toThenable

	let promises = providers.map(provider => toThenable(provider.provideFoldingRanges(model, foldingContext, cancellationToken)));
開發者ID:jumpinjackie,項目名稱:sqlopsstudio,代碼行數:1,代碼來源:syntaxRangeProvider.ts


注:本文中的vs/base/common/async.toThenable函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。