eagerly resolve the first N items, the rest lazy, https://github.com/microsoft/vscode/issues/146468

This commit is contained in:
Johannes 2022-04-06 15:34:52 +02:00
parent 1ede7cf6bd
commit 3a936460b4
No known key found for this signature in database
GPG key ID: 6DEF802A22264FCA

View file

@ -68,6 +68,8 @@ class InlineCompletionResults extends RefCountedDisposable implements InlineComp
const first = Iterable.slice(items, selectedIndex);
const second = Iterable.slice(items, 0, selectedIndex);
let resolveCount = 5;
for (const item of Iterable.concat(first, second)) {
if (item.score === FuzzyScore.Default) {
@ -91,6 +93,11 @@ class InlineCompletionResults extends RefCountedDisposable implements InlineComp
item.completion.command,
item
));
// resolve the first N suggestions eagerly
if (resolveCount-- >= 0) {
item.resolve(CancellationToken.None);
}
}
return result;
}