# Fix Suggest dropdown/inline completion partial accept (via next token/line) race#197633
# Fix Suggest dropdown/inline completion partial accept (via next token/line) race#197633hediet merged 4 commits intomicrosoft:mainfrom
Conversation
|
Thanks for this very deep investigation and the explanations! What I don't understand at a first glance though, is why there is a race condition in the first place. Actually, I don't think it is a race condition. Here is the stack from the repro: freeInlineCompletions (VM264:158) - Deletes the inline completion |
# Fix Suggest dropdown/inline completion partial accept (via next token/line) race
Repro steps:
monaco playground
Note that this is a race and does not trigger every time in the playground, but may be amplified by fullter event loop (running in vscode) offsetting the partialAccept trigger execution after the SuggestDropdown clear.
(Add breakpoints on the free & acceptPartial completion)
ein the already existingconsolconsoleappears, accept next token/next line (e.g. ctrl+right)expected:
The partialAccept is called before free, otherwise the extHost reference to the item will get disposed prematurely.
The following snippet fixes it quickly by increasing the ref count to active completions (containing also standard inlineCompletions for consistency), and disposing after the partialAccept finished.
Note: If the onHide functionality is being implemented, the same may be required for the
Acceptas the reference to the active InlineCompletion might be dropped at the time the Hide event is triggered.closes #195385