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


TypeScript HoverProviderRegistry.ordered方法代码示例

本文整理汇总了TypeScript中vs/editor/common/modes.HoverProviderRegistry.ordered方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HoverProviderRegistry.ordered方法的具体用法?TypeScript HoverProviderRegistry.ordered怎么用?TypeScript HoverProviderRegistry.ordered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/editor/common/modes.HoverProviderRegistry的用法示例。


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

示例1: getHover

export function getHover(model: ITextModel, position: Position, token: CancellationToken): Promise<Hover[]> {

	const supports = HoverProviderRegistry.ordered(model);

	const promises = supports.map(support => {
		return Promise.resolve(support.provideHover(model, position, token)).then(hover => {
			return hover && isValid(hover) ? hover : undefined;
		}, err => {
			onUnexpectedExternalError(err);
			return undefined;
		});
	});

	return Promise.all(promises).then(coalesce);
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:15,代码来源:getHover.ts

示例2: provideHover

export function provideHover(model: IReadOnlyModel, position: IEditorPosition, cancellationToken = CancellationToken.None): Thenable<Hover[]> {

	const supports = HoverProviderRegistry.ordered(model);
	const values: Hover[] = [];

	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);
		});
	});

	return TPromise.join(promises).then(() => coalesce(values));
}
开发者ID:ccding-ustc,项目名称:vscode,代码行数:21,代码来源:hover.ts

示例3: getHover

export function getHover(model: ITextModel, position: Position): TPromise<Hover[]> {

	const supports = HoverProviderRegistry.ordered(model);
	const values: Hover[] = [];

	const promises = supports.map((support, idx) => {
		return asWinJsPromise((token) => {
			return support.provideHover(model, position, token);
		}).then((result) => {
			if (result) {
				let hasRange = (typeof result.range !== 'undefined');
				let hasHtmlContent = typeof result.contents !== 'undefined' && result.contents && result.contents.length > 0;
				if (hasRange && hasHtmlContent) {
					values[idx] = result;
				}
			}
		}, err => {
			onUnexpectedExternalError(err);
		});
	});

	return TPromise.join(promises).then(() => coalesce(values));
}
开发者ID:AllureFer,项目名称:vscode,代码行数:23,代码来源:getHover.ts


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