本文整理匯總了TypeScript中vs/editor/common/modes.DefinitionProviderRegistry.ordered方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript DefinitionProviderRegistry.ordered方法的具體用法?TypeScript DefinitionProviderRegistry.ordered怎麽用?TypeScript DefinitionProviderRegistry.ordered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/modes.DefinitionProviderRegistry
的用法示例。
在下文中一共展示了DefinitionProviderRegistry.ordered方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getDeclarationsAtPosition
export function getDeclarationsAtPosition(model: IReadOnlyModel, position: IEditorPosition): TPromise<Location[]> {
const provider = DefinitionProviderRegistry.ordered(model);
// get results
const promises = provider.map((provider, idx) => {
return asWinJsPromise((token) => {
return provider.provideDefinition(model, position, token);
}).then(result => {
return result;
}, err => {
onUnexpectedError(err);
});
});
return TPromise.join(promises).then(allReferences => {
let result: Location[] = [];
for (let references of allReferences) {
if (Array.isArray(references)) {
result.push(...references);
} else if (references) {
result.push(references);
}
}
return result;
});
}
示例2: getDeclarationsAtPosition
export function getDeclarationsAtPosition(model: IReadOnlyModel, position: Position): TPromise<Location[]> {
const provider = DefinitionProviderRegistry.ordered(model);
// get results
const promises = provider.map((provider, idx) => {
return asWinJsPromise((token) => {
return provider.provideDefinition(model, position, token);
}).then(result => {
return result;
}, err => {
onUnexpectedExternalError(err);
});
});
return outputResults(promises);
}