Skip to content

Commit

Permalink
Fixes #180538 (#180683)
Browse files Browse the repository at this point in the history
  • Loading branch information
hediet authored Apr 24, 2023
1 parent e3018c3 commit 5f20cf6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export async function provideInlineCompletions(
token: CancellationToken = CancellationToken.None,
languageConfigurationService?: ILanguageConfigurationService,
): Promise<InlineCompletionProviderResult> {
// Important: Don't use position after the await calls, as the model could have been changed in the meantime!
const defaultReplaceRange = getDefaultRange(position, model);

const providers = registry.all(model);
const providerResults = await Promise.all(providers.map(async provider => {
try {
Expand All @@ -38,8 +41,6 @@ export async function provideInlineCompletions(
return ({ provider, completions: undefined });
}));

const defaultReplaceRange = getDefaultRange(position, model);

const itemsByHash = new Map<string, InlineCompletionItem>();
const lists: InlineCompletionList[] = [];
for (const result of providerResults) {
Expand Down

0 comments on commit 5f20cf6

Please sign in to comment.