-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Launchpad Search: Searches only when nothing is found #3770
base: main
Are you sure you want to change the base?
Launchpad Search: Searches only when nothing is found #3770
Conversation
d30067e
to
ba24f42
Compare
// wait a little bit because the active quickpick is updated with some delay | ||
await new Promise(resolve => setTimeout(resolve, 100)); | ||
const hasActiveLaunchpadItems = quickpick.activeItems.find(i => 'item' in i); | ||
if (hasActiveLaunchpadItems) { | ||
// We have an active item, so we can exit now without sending any requests to API | ||
this.updateItemsDebouncer.cancel(); | ||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be handled by the onDidChangeActive
event? That way we wouldn't need to create a fake Promise to await
onDidChangeActive: async quickpick => {
// Not sure if this needs an await
const hasActiveLaunchpadItems = await quickpick.activeItems.find(i => 'item' in i);
if (hasActiveLaunchpadItems) {
this.updateItemsDebouncer.cancel();
return true;
}
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sergiolms
There are following problems:
- I'm not sure that it's guaranteed that
onDidChangeActive
is called after thanonDidChangeValue
. - If after typing, then
onDidChangeValue
won't probably be called at all. - It just never gets executed:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the code suggestion here #3770 (comment) and test if it works for you too. This is working for me:
Grabacion.de.pantalla.2024-11-19.a.las.15.44.09.mov
ba24f42
to
bc466d0
Compare
Hey @sergeibbb, while reviewing your PR, I'd suggest the following code changes: You can also review and apply these suggestions locally on your machine. Learn more about GitKraken Code Suggest
Join your team on GitKraken to speed up PR review. |
(#3763)
Checklist
Fixes $XXX -
orCloses #XXX -
prefix to auto-close the issue that your PR addresses