diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd4fd1120e49..2514f882c53e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Changed - Changes the _Search & Compare_ view to be separate (detached) from the new grouped _GitLens_ view +- API search in the _Launchpad_ is activated only when nothing is found locally ### Fixed diff --git a/src/commands/quickCommand.ts b/src/commands/quickCommand.ts index 71bced2c40df2..70d3bdcb7203d 100644 --- a/src/commands/quickCommand.ts +++ b/src/commands/quickCommand.ts @@ -73,6 +73,7 @@ export interface QuickPickStep { onDidActivate?(quickpick: QuickPick): void; onDidAccept?(quickpick: QuickPick): boolean | Promise; + onDidChangeActive?(quickpick: QuickPick): boolean | Promise; onDidChangeValue?(quickpick: QuickPick): boolean | Promise; onDidChangeSelection?(quickpick: QuickPick, selection: readonly T[]): void; onDidClickButton?( diff --git a/src/commands/quickWizard.base.ts b/src/commands/quickWizard.base.ts index 7192eaf101843..7eb9eaa1a5d52 100644 --- a/src/commands/quickWizard.base.ts +++ b/src/commands/quickWizard.base.ts @@ -621,6 +621,11 @@ export abstract class QuickWizardCommandBase extends GlCommandBase { firstActiveChange = false; } + if (step.onDidChangeActive != null) { + const cancel = step.onDidChangeActive(quickpick); + if (cancel) return; + } + if (rootStep.command != null || quickpick.activeItems.length === 0) return; const command = quickpick.activeItems[0]; diff --git a/src/plus/launchpad/launchpad.ts b/src/plus/launchpad/launchpad.ts index 31e4dd37e9e54..54e6c3d2d9b51 100644 --- a/src/plus/launchpad/launchpad.ts +++ b/src/plus/launchpad/launchpad.ts @@ -744,6 +744,17 @@ export class LaunchpadCommand extends QuickCommand { this.savedSearch = undefined; }, + + onDidChangeActive: quickpick => { + const hasActiveLaunchpadItems = quickpick.activeItems.find(i => 'item' in i); + if (hasActiveLaunchpadItems) { + context.updateItemsDebouncer.cancel(); + return true; + } + + return false; + }, + onDidChangeValue: async quickpick => { const { value } = quickpick; this.savedSearch = value;