src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts/AbstractTaskService/_showQuickPick
class AbstractTaskService:	private async _showQuickPick(tasks: Promise<Task[]> | Task[], placeHolder: string, defaultEntry?: ITaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, additionalEntries?: ITaskQuickPickEntry[], type?: string, name?: string): Promise<ITaskQuickPickEntry | undefined | null> {
		const tokenSource = new CancellationTokenSource();
		const cancellationToken: CancellationToken = tokenSource.token;
		const createEntries = new Promise<QuickPickInput<ITaskQuickPickEntry>[]>((resolve) => {
			if (Array.isArray(tasks)) {
				resolve(this._createTaskQuickPickEntries(tasks, group, sort, selectedEntry));
			} else {
				resolve(tasks.then((tasks) => this._createTaskQuickPickEntries(tasks, group, sort, selectedEntry)));
			}
		});

		const timeout: boolean = await Promise.race([new Promise<boolean>((resolve) => {
			createEntries.then(() => resolve(false));
		}), new Promise<boolean>((resolve) => {
			const timer = setTimeout(() => {
				clearTimeout(timer);
				resolve(true);
			}, 200);
		})]);

		if (!timeout && ((await createEntries).length === 1) && this._configurationService.getValue<boolean>(QUICKOPEN_SKIP_CONFIG)) {
			return (<ITaskQuickPickEntry>(await createEntries)[0]);
		}

		const pickEntries = createEntries.then((entries) => {
			if ((entries.length === 1) && this._configurationService.getValue<boolean>(QUICKOPEN_SKIP_CONFIG)) {
				tokenSource.cancel();
			} else if ((entries.length === 0) && defaultEntry) {
				entries.push(defaultEntry);
			} else if (entries.length > 1 && additionalEntries && additionalEntries.length > 0) {
				entries.push({ type: 'separator', label: '' });
				entries.push(additionalEntries[0]);
			}
			return entries;
		});

		const picker: IQuickPick<ITaskQuickPickEntry> = this._quickInputService.createQuickPick();
		picker.placeholder = placeHolder;
		picker.matchOnDescription = true;
		if (name) {
			picker.value = name;
		}
		picker.onDidTriggerItemButton(context => {
			const task = context.item.task;
			this._quickInputService.cancel();
			if (ContributedTask.is(task)) {
				this.customize(task, undefined, true);
			} else if (CustomTask.is(task)) {
				this.openConfig(task);
			}
		});
		picker.busy = true;
		pickEntries.then(entries => {
			picker.busy = false;
			picker.items = entries;
			picker.show();
		});

		return new Promise<ITaskQuickPickEntry | undefined | null>(resolve => {
			this._register(picker.onDidAccept(async () => {
				let selection = picker.selectedItems ? picker.selectedItems[0] : undefined;
				if (cancellationToken.isCancellationRequested) {
					// canceled when there's only one task
					const task = (await pickEntries)[0];
					if ((<any>task).task) {
						selection = <ITaskQuickPickEntry>task;
					}
				}
				picker.dispose();
				if (!selection) {
					resolve(undefined);
				}
				resolve(selection);
			}));
		});
	}