From 7b275d276c63ac62f654a09a91e8b960200e1129 Mon Sep 17 00:00:00 2001 From: Vladyslav Zhukovskyi Date: Tue, 14 Jan 2020 11:40:37 +0200 Subject: [PATCH] Return undefined if empty array passed into quick pick service Signed-off-by: Vladyslav Zhukovskyi --- .../core/src/browser/quick-open/quick-pick-service-impl.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/browser/quick-open/quick-pick-service-impl.ts b/packages/core/src/browser/quick-open/quick-pick-service-impl.ts index 6c75605287ebb..42af42b56f1ac 100644 --- a/packages/core/src/browser/quick-open/quick-pick-service-impl.ts +++ b/packages/core/src/browser/quick-open/quick-pick-service-impl.ts @@ -38,6 +38,10 @@ export class QuickPickServiceImpl implements QuickPickService { async show(elements: (string | QuickPickItem)[], options?: QuickPickOptions): Promise { return new Promise(resolve => { this.items = this.toItems(elements, resolve); + if (this.items.length === 0) { + resolve(undefined); + return; + } // Set `runIfSingle` to the value passed through options, else defaults to true. const runIfSingle: boolean = (options && options.runIfSingle !== undefined) ? options.runIfSingle : true; if (runIfSingle && this.items.length === 1) {