import { AzureWizardPromptStep , IAzureQuickPickItem } from 'vscode-azureextensionui' ; import { localize } from '../localize' ; import { nonNullProp } from '../utils/nonNull' ; import { getGitHubQuickPicksWithLoadMore , gitHubRepoData , ICachedQuickPicks } from './connectToGitHub' ; import { IConnectToGitHubWizardContext } from './IConnectToGitHubWizardContext' ; export class GitHubRepoListStep extends AzureWizardPromptStep < IConnectToGitHubWizardContext > { public async prompt ( context ) { const placeHolder = localize ( 'chooseRepo' , 'Choose repository' ) ; let repoData ; const picksCache = { picks : [ ] } ; let url = nonNullProp ( context , 'orgData' ) . repos_url ; while ( true ) { repoData = ( await context . ui . showQuickPick ( this . getRepositories ( context , picksCache , url ) , { placeHolder } ) ) . data ; if ( typeof repoData === 'string' ) { url = repoData ; } else { break ; } } context . repoData = repoData ; } public shouldPrompt ( context ) { return ! context . repoData ; } private async getRepositories ( context , picksCache , url ) { return await getGitHubQuickPicksWithLoadMore < gitHubRepoData > ( context , picksCache , url , 'name' ) ; } }