Created
January 8, 2021 19:25
-
-
Save ecool/a6b12280c61c83561ed0e421f685882f to your computer and use it in GitHub Desktop.
QuickPick Multi-Select Custom Input Issue Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function showMultiSelectInputBox(): Promise<string[]> { | |
const items = ["testing", "boop", "77708"]; | |
const mappedItems = items.map((item) => ({ label: item })); | |
return new Promise((resolve, _) => { | |
const quickPick = window.createQuickPick(); | |
quickPick.placeholder = "Select/Insert a selection."; | |
quickPick.items = mappedItems; | |
// when this is true, quickPick.activeItems is an empty list [] onDidAccept | |
// quickPick.canSelectMany = false; | |
quickPick.canSelectMany = true; | |
quickPick.onDidAccept(_ => { | |
console.log(quickPick); | |
// resolves to empty list | |
resolve(quickPick.activeItems.map((item) => item.label)); | |
quickPick.hide(); | |
}); | |
// Allows for custom item to be selected | |
// quickPick.onDidChangeValue(_ => { | |
// if (quickPick.value === "") { | |
// quickPick.items = mappedItems; | |
// } else { | |
// // include currently typed option | |
// quickPick.items = [{ label: quickPick.value }, ...mappedItems]; | |
// } | |
// }); | |
quickPick.onDidHide(_ => quickPick.dispose()); | |
quickPick.show(); | |
}); | |
} |
Author
ecool
commented
Jan 8, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment