本文整理匯總了TypeScript中vs/editor/common/modes.LinkProviderRegistry類的典型用法代碼示例。如果您正苦於以下問題:TypeScript LinkProviderRegistry類的具體用法?TypeScript LinkProviderRegistry怎麽用?TypeScript LinkProviderRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了LinkProviderRegistry類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
});
}
示例5: registerLinkProvider
export function registerLinkProvider(languageId: string, provider: modes.LinkProvider): IDisposable {
return modes.LinkProviderRegistry.register(languageId, provider);
}