From cc2c878c5c7d2f7e50a04a022392a954b2b16e94 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Wed, 31 Jan 2024 18:36:34 +0200 Subject: [PATCH] #747 - Add select options --- CHANGELOG.md | 1 + src/helpers/CustomScript.ts | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ca1d6db..23813ed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - [#727](https://github.com/estruyf/vscode-front-matter/pull/727): Updated Japanese translations thanks to [mayumihara](https://github.com/mayumih387) - [#737](https://github.com/estruyf/vscode-front-matter/issues/737): Optimize the grid layout of the content and media dashboards - [#741](https://github.com/estruyf/vscode-front-matter/issues/741): Added message on the content dashboard when content is processed +- [#747](https://github.com/estruyf/vscode-front-matter/issues/747): The `@frontmatter/extensibility` dependency now supports scripts for placeholders ### ⚡️ Optimizations diff --git a/src/helpers/CustomScript.ts b/src/helpers/CustomScript.ts index 8c60ca0f..bc9ba5cb 100644 --- a/src/helpers/CustomScript.ts +++ b/src/helpers/CustomScript.ts @@ -397,12 +397,21 @@ export class CustomScript { for (const question of data.questions) { if (question.name && question.message) { - const answer = await window.showInputBox({ - prompt: question.message, - value: question.default || '', - ignoreFocusOut: true, - title: question.message - }); + let answer; + if (question.options) { + answer = await window.showQuickPick(question.options, { + title: question.message, + ignoreFocusOut: true, + canPickMany: false + }); + } else { + answer = await window.showInputBox({ + prompt: question.message, + value: question.default || '', + ignoreFocusOut: true, + title: question.message + }); + } if (answer) { answers.push(`${question.name}="${answer}"`);