Merge pull request #130399 from Kingwl/fix_folding_with_inlayhints
Fix folding ranges with inlay hints
This commit is contained in:
commit
37f845ee35
|
@ -38,13 +38,16 @@ export interface InlayHintsData {
|
|||
export async function getInlayHints(model: ITextModel, ranges: Range[], token: CancellationToken): Promise<InlayHintsData[]> {
|
||||
const datas: InlayHintsData[] = [];
|
||||
const providers = InlayHintsProviderRegistry.ordered(model).reverse();
|
||||
const promises = flatten(providers.map(provider => ranges.map(range => Promise.resolve(provider.provideInlayHints(model, range, token)).then(result => {
|
||||
if (result) {
|
||||
datas.push({ list: result, provider });
|
||||
}
|
||||
}, err => {
|
||||
onUnexpectedExternalError(err);
|
||||
}))));
|
||||
const promises = flatten(providers.map(provider => ranges.map(range => {
|
||||
return Promise.resolve(provider.provideInlayHints(model, range, token)).then(result => {
|
||||
const itemsInRange = result?.filter(hint => range.containsPosition(hint.position));
|
||||
if (itemsInRange?.length) {
|
||||
datas.push({ list: itemsInRange, provider });
|
||||
}
|
||||
}, err => {
|
||||
onUnexpectedExternalError(err);
|
||||
});
|
||||
})));
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
|
|
Loading…
Reference in a new issue