MCPcopy Create free account
hub / github.com/microsoft/vscode-extension-samples / activate

Function activate

quickinput-sample/src/extension.ts:11–30  ·  view source on GitHub ↗
(context: ExtensionContext)

Source from the content-addressed store, hash-verified

9import { quickOpen } from './quickOpen';
10
11export 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}

Callers

nothing calls this directly

Calls 2

showMethod · 0.80
disposeMethod · 0.65

Tested by

no test coverage detected