From d81f0a4067df27d0a298459ebf895641e8130b4b Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 25 Jan 2023 19:04:21 +0100 Subject: [PATCH] Fixes #164716 (#172421) --- .../inlineCompletions/browser/suggestWidgetPreviewModel.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/inlineCompletions/browser/suggestWidgetPreviewModel.ts b/src/vs/editor/contrib/inlineCompletions/browser/suggestWidgetPreviewModel.ts index 0391d402bc14d..0eec15a2de72d 100644 --- a/src/vs/editor/contrib/inlineCompletions/browser/suggestWidgetPreviewModel.ts +++ b/src/vs/editor/contrib/inlineCompletions/browser/suggestWidgetPreviewModel.ts @@ -21,7 +21,11 @@ export class SuggestWidgetPreviewModel extends BaseGhostTextWidgetModel { new SuggestWidgetInlineCompletionProvider( this.editor, // Use the first cache item (if any) as preselection. - () => this.cache.value?.completions[0]?.toLiveInlineCompletion() + () => { + // We might get asked in a content change event before the cache has received that event. + this.cache.value?.updateRanges(); + return this.cache.value?.completions[0]?.toLiveInlineCompletion(); + } ) ); private readonly updateOperation = this._register(new MutableDisposable());