2018-06-15 16:47:11 +02:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
import { window, commands, ExtensionContext } from 'vscode';
|
2018-06-28 11:36:23 +02:00
|
|
|
import { showQuickPick, showInputBox } from './basicInput';
|
2018-06-15 16:47:11 +02:00
|
|
|
import { multiStepInput } from './multiStepInput';
|
|
|
|
|
import { quickOpen } from './quickOpen';
|
|
|
|
|
|
|
|
|
|
export function activate(context: ExtensionContext) {
|
2022-09-20 14:44:57 -07:00
|
|
|
context.subscriptions.push(commands.registerCommand('samples.quickInput', async () => {
|
2018-06-15 16:47:11 +02:00
|
|
|
const options: { [key: string]: (context: ExtensionContext) => Promise<void> } = {
|
2018-06-28 11:36:23 +02:00
|
|
|
showQuickPick,
|
2018-06-15 16:47:11 +02:00
|
|
|
showInputBox,
|
|
|
|
|
multiStepInput,
|
|
|
|
|
quickOpen,
|
|
|
|
|
};
|
|
|
|
|
const quickPick = window.createQuickPick();
|
|
|
|
|
quickPick.items = Object.keys(options).map(label => ({ label }));
|
|
|
|
|
quickPick.onDidChangeSelection(selection => {
|
|
|
|
|
if (selection[0]) {
|
2022-09-20 14:44:57 -07:00
|
|
|
options[selection[0k].label](context)
|
2018-06-15 16:47:11 +02:00
|
|
|
.catch(console.error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
quickPick.onDidHide(() => quickPick.dispose());
|
|
|
|
|
quickPick.show();
|
|
|
|
|
}));
|
|
|
|
|
}
|