本文整理汇总了TypeScript中vs/editor/common/modes.LinkProviderRegistry.ordered方法的典型用法代码示例。如果您正苦于以下问题:TypeScript LinkProviderRegistry.ordered方法的具体用法?TypeScript LinkProviderRegistry.ordered怎么用?TypeScript LinkProviderRegistry.ordered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/modes.LinkProviderRegistry
的用法示例。
在下文中一共展示了LinkProviderRegistry.ordered方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getLinks
export function getLinks(model: ITextModel, token: CancellationToken): Promise<LinksList> {
const lists: [ILinksList, LinkProvider][] = [];
// ask all providers for links in parallel
const promises = LinkProviderRegistry.ordered(model).reverse().map((provider, i) => {
return Promise.resolve(provider.provideLinks(model, token)).then(result => {
if (result) {
lists[i] = [result, provider];
}
}, onUnexpectedExternalError);
});
return Promise.all(promises).then(() => new LinksList(coalesce(lists)));
}
示例2: getLinks
export function getLinks(model: IReadOnlyModel): TPromise<ILink[]> {
let links: ILink[] = [];
// ask all providers for links in parallel
const promises = LinkProviderRegistry.ordered(model).reverse().map(support => {
return asWinJsPromise(token => support.provideLinks(model, token)).then(result => {
if (Array.isArray(result)) {
links = union(links, result);
}
}, onUnexpectedError);
});
return TPromise.join(promises).then(() => {
return links;
});
}
示例3: getLinks
export function getLinks(model: ITextModel, token: CancellationToken): Promise<Link[]> {
let links: Link[] = [];
// ask all providers for links in parallel
const promises = LinkProviderRegistry.ordered(model).reverse().map(provider => {
return Promise.resolve(provider.provideLinks(model, token)).then(result => {
if (Array.isArray(result)) {
const newLinks = result.map(link => new Link(link, provider));
links = union(links, newLinks);
}
}, onUnexpectedExternalError);
});
return Promise.all(promises).then(() => {
return links;
});
}
示例4: getLinks
export function getLinks(model: IReadOnlyModel): TPromise<Link[]> {
let links: Link[] = [];
// ask all providers for links in parallel
const promises = LinkProviderRegistry.ordered(model).reverse().map(provider => {
return asWinJsPromise(token => provider.provideLinks(model, token)).then(result => {
if (Array.isArray(result)) {
const newLinks = result.map(link => new Link(link, provider));
links = union(links, newLinks);
}
}, onUnexpectedExternalError);
});
return TPromise.join(promises).then(() => {
return links;
});
}