Skip to content

Commit e8fb0f3

Browse files
chivorotkivsergeibbb
authored andcommitted
Searches only when nothing is found,
and improves delayed detection of active items: uses `onDidChangeActive` instead of a timout delay (#3763, #3770)
1 parent 2f376b8 commit e8fb0f3

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
4949
### Changed
5050

5151
- Changes the _Search & Compare_ view to be separate (detached) from the new grouped _GitLens_ view
52+
- API search in the _Launchpad_ is activated only when nothing is found locally
5253

5354
### Fixed
5455

src/commands/quickCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export interface QuickPickStep<T extends QuickPickItem = QuickPickItem> {
7373
onDidActivate?(quickpick: QuickPick<DirectiveQuickPickItem | T>): void;
7474

7575
onDidAccept?(quickpick: QuickPick<DirectiveQuickPickItem | T>): boolean | Promise<boolean>;
76+
onDidChangeActive?(quickpick: QuickPick<DirectiveQuickPickItem | T>): boolean | Promise<boolean>;
7677
onDidChangeValue?(quickpick: QuickPick<DirectiveQuickPickItem | T>): boolean | Promise<boolean>;
7778
onDidChangeSelection?(quickpick: QuickPick<DirectiveQuickPickItem | T>, selection: readonly T[]): void;
7879
onDidClickButton?(

src/commands/quickWizard.base.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,11 @@ export abstract class QuickWizardCommandBase extends GlCommandBase {
621621
firstActiveChange = false;
622622
}
623623

624+
if (step.onDidChangeActive != null) {
625+
const cancel = step.onDidChangeActive(quickpick);
626+
if (cancel) return;
627+
}
628+
624629
if (rootStep.command != null || quickpick.activeItems.length === 0) return;
625630

626631
const command = quickpick.activeItems[0];

src/plus/launchpad/launchpad.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,17 @@ export class LaunchpadCommand extends QuickCommand<State> {
744744

745745
this.savedSearch = undefined;
746746
},
747+
748+
onDidChangeActive: quickpick => {
749+
const hasActiveLaunchpadItems = quickpick.activeItems.find(i => 'item' in i);
750+
if (hasActiveLaunchpadItems) {
751+
context.updateItemsDebouncer.cancel();
752+
return true;
753+
}
754+
755+
return false;
756+
},
757+
747758
onDidChangeValue: async quickpick => {
748759
const { value } = quickpick;
749760
this.savedSearch = value;

0 commit comments

Comments
 (0)