import { AzureWizardPromptStep , IAzureQuickPickItem } from 'vscode-azureextensionui' ; import { localize } from '../localize' ; import { nonNullProp } from '../utils/nonNull' ; import { getGitHubQuickPicksWithLoadMore , gitHubBranchData , ICachedQuickPicks } from './connectToGitHub' ; import { IConnectToGitHubWizardContext } from './IConnectToGitHubWizardContext' ; export class GitHubBranchListStep extends AzureWizardPromptStep < IConnectToGitHubWizardContext > { public async prompt ( context ) { const placeHolder = localize ( 'chooseBranch' , 'Choose branch' ) ; let branchData ; const picksCache = { picks : [ ] } ; let url = `${ nonNullProp ( context , 'repoData' ) . url }/branches` ; while ( true ) { branchData = ( await context . ui . showQuickPick ( this . getBranchPicks ( context , picksCache , url ) , { placeHolder } ) ) . data ; if ( typeof branchData === 'string' ) { url = branchData ; } else { break ; } } context . branchData = branchData ; } public shouldPrompt ( context ) { return ! context . branchData ; } private async getBranchPicks ( context , picksCache , url ) { return await getGitHubQuickPicksWithLoadMore < gitHubBranchData > ( context , picksCache , url , 'name' ) ; } }