-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# Fix Suggest dropdown/inline completion partial accept (via next token/line) race #197633
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)
e
in the already existingconsol
console
appears, 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
Accept
as the reference to the active InlineCompletion might be dropped at the time the Hide event is triggered.closes #195385