当前位置: 首页>>代码示例>>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;未经允许,请勿转载。