From d7daa20169f82ce590e92af1d4a1a4958c190186 Mon Sep 17 00:00:00 2001 From: Marcel Robitaille Date: Thu, 3 Oct 2024 20:12:09 +0200 Subject: [PATCH] Fix #112 --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/lib/CommandHandler.ts | 11 +++++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5269ff..5d17f85 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [1.12.4] 2024-10-03 + +- Work around VSCode bug with activeItems and selectedItems (#112) + ## [1.12.3] 2024-10-03 - Fix custom values not being returned (#113) diff --git a/package-lock.json b/package-lock.json index f103602..51092bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tasks-shell-input", - "version": "1.12.3", + "version": "1.12.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tasks-shell-input", - "version": "1.12.3", + "version": "1.12.4", "devDependencies": { "@types/glob": "8.1.0", "@types/node": "20.11.30", diff --git a/package.json b/package.json index 21d32ae..149c15c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Tasks Shell Input", "description": "Use shell commands as input for your tasks", "icon": "icon.png", - "version": "1.12.3", + "version": "1.12.4", "publisher": "augustocdias", "repository": { "url": "https://github.com/augustocdias/vscode-shell-command" diff --git a/src/lib/CommandHandler.ts b/src/lib/CommandHandler.ts index 1ce961a..045ba28 100755 --- a/src/lib/CommandHandler.ts +++ b/src/lib/CommandHandler.ts @@ -329,8 +329,15 @@ export class CommandHandler { disposable = vscode.Disposable.from(...disposableLikes); picker.items = constantItems; - picker.activeItems = picker.items.filter( - (item) => defaultValues.includes((item as QuickPickItem).value)); + + const activeItems = [...picker.items.filter( + (item) => defaultValues.includes((item as QuickPickItem).value))]; + + // Assigning unconditionally can break selectedItems in callbacks + // See #112 + if (activeItems.length) { + picker.activeItems = activeItems; + } picker.show(); }).finally(() => {