diff --git a/src/plus/startWork/startWork.ts b/src/plus/startWork/startWork.ts index f2c408bbed775..732ef76d5fd11 100644 --- a/src/plus/startWork/startWork.ts +++ b/src/plus/startWork/startWork.ts @@ -161,22 +161,8 @@ export class StartWorkCommand extends QuickCommand { } } - await updateContextItems(this.container, context); - if (this.container.telemetry.enabled) { - this.container.telemetry.sendEvent( - opened ? 'startWork/steps/issue' : 'startWork/opened', - { - ...context.telemetryContext!, - connected: true, - type: state.type, - }, - this.source, - ); - } - + const result = yield* this.pickIssueStep(state, context, opened); opened = true; - - const result = yield* this.pickIssueStep(state, context); if (result === StepResultBreak) continue; if (!isStartWorkTypeItem(result)) { state.item = result; @@ -420,6 +406,7 @@ export class StartWorkCommand extends QuickCommand { private *pickIssueStep( state: StepState, context: Context, + opened: boolean, ): StepResultGenerator { const buildIssueItem = (i: StartWorkItem) => { const buttons = i.item.issue.url ? [OpenOnGitHubQuickInputButton] : []; @@ -470,14 +457,37 @@ export class StartWorkCommand extends QuickCommand { }; } - const { items, placeholder } = getItemsAndPlaceholder(); + const updateItems = async (quickpick: QuickPick) => { + quickpick.busy = true; + try { + await updateContextItems(this.container, context); + const { items, placeholder } = getItemsAndPlaceholder(); + quickpick.placeholder = placeholder; + quickpick.items = items; + + if (this.container.telemetry.enabled) { + this.container.telemetry.sendEvent( + opened ? 'startWork/steps/issue' : 'startWork/opened', + { + ...context.telemetryContext!, + connected: true, + type: state.type, + }, + this.source, + ); + } + } finally { + quickpick.busy = false; + } + }; - const step = createPickStep<(typeof items)[0]>({ + const step = createPickStep>({ title: context.title, - placeholder: placeholder, + placeholder: 'Loading...', matchOnDescription: true, matchOnDetail: true, - items: items, + items: [], + onDidActivate: updateItems, onDidClickItemButton: (_quickpick, button, { item }) => { if (button === OpenOnGitHubQuickInputButton && !isStartWorkTypeItem(item)) { this.open(item);