Skip to content

Commit

Permalink
#747 - Add select options
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Jan 31, 2024
1 parent 273af6d commit cc2c878
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 15 additions & 6 deletions src/helpers/CustomScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}"`);
Expand Down

0 comments on commit cc2c878

Please sign in to comment.