| 9 | import { quickOpen } from './quickOpen'; |
| 10 | |
| 11 | export function activate(context: ExtensionContext) { |
| 12 | context.subscriptions.push(commands.registerCommand('samples.quickInput', async () => { |
| 13 | const options: Record<string, (context: ExtensionContext) => Promise<void>> = { |
| 14 | showQuickPick, |
| 15 | showInputBox, |
| 16 | multiStepInput, |
| 17 | quickOpen, |
| 18 | }; |
| 19 | const quickPick = window.createQuickPick(); |
| 20 | quickPick.items = Object.keys(options).map(label => ({ label })); |
| 21 | quickPick.onDidChangeSelection(selection => { |
| 22 | if (selection[0]) { |
| 23 | options[selection[0].label](context) |
| 24 | .catch(console.error); |
| 25 | } |
| 26 | }); |
| 27 | quickPick.onDidHide(() => quickPick.dispose()); |
| 28 | quickPick.show(); |
| 29 | })); |
| 30 | } |