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
QuickPick: onDidHide not fired for subsequent hide when a show is called after a hide #135747
Comments
Reopened after adding the context of the bug. |
Yes this is a tricky one...it's a race condition... this comes from the fact that When you call That code that sends a message is here: vscode/src/vs/workbench/api/common/extHostQuickOpen.ts Lines 399 to 400 in ab8955c
The code that does handle the vscode/src/vs/workbench/api/common/extHostQuickOpen.ts Lines 422 to 425 in ab8955c
The problem we're seeing is... you call but that 2nd time I'm not sure we can have I am wondering... Why are you calling |
@chrmarti not sure if you have any thoughts on this. |
Thanks for the explanation of the current implementation.
I was imagining there's a queue internally to handle If there was an internally queue to handle show and hide, I don't imagine it requires changes to the current API.
Not the exact code of how I discover this bug, but something like this. I would like to hide the menu first before execute command (because some commands don't work when the quickpick is in focus). async function doSomething() {
if (hasCommand) {
await executeCommand(command);
}
}
quickpick.hide();
await doSomething();
quickpick.show();
// Then manually hide the quickpick in the uI |
This would require the API to be asnyc. Which we cannot change. In any case, after talking to @chrmarti, he and I both think that |
The show and hide will enqueue without waiting, so the API will still be synchronous. Regardless, seems like you are able to fix it in another way. Thanks for looking into the issue. |
Issue Type: Bug
Calling show before waiting on the
onDidHide
will cause onDidHide to not fire on the subsequent hide for QuickPick.Steps to Reproduce:
RESULT:
You should see the following results in the console.
Only one onDidHide was triggered and no additional onDidHide is trigger after a manual hiding with
ESC
from the UI.EXPECTED:
Expected there is an additional
onDIdHide
being triggered after manually hide the quick pick withESC
like the follow ing output.The only workaround is to wait onDIdHide is triggered before calling show again.
For example:
The output of this workaround is as expected
VS Code version: Code 1.61.2 (6cba118, 2021-10-19T15:49:28.381Z)
OS version: Darwin x64 20.6.0
Restricted Mode: No
System Info
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: