(selectableFolderPaths: string[], prePickedFolders: Set<string> | undefined, placeHolder: string)
| 104 | } |
| 105 | |
| 106 | async function showFolderMultiPicker(selectableFolderPaths: string[], prePickedFolders: Set<string> | undefined, placeHolder: string): Promise<string[] | undefined> { |
| 107 | // No point asking the user if there's only one. |
| 108 | if (selectableFolderPaths.length === 1) { |
| 109 | return selectableFolderPaths; |
| 110 | } |
| 111 | |
| 112 | const items = selectableFolderPaths.map((selectableFolderPath) => { |
| 113 | const workspaceFolder = vs.workspace.getWorkspaceFolder(Uri.file(selectableFolderPath)); |
| 114 | if (!workspaceFolder) |
| 115 | return undefined; |
| 116 | |
| 117 | const workspacePathParent = path.dirname(fsPath(workspaceFolder.uri)); |
| 118 | return { |
| 119 | description: homeRelativePath(workspacePathParent), |
| 120 | label: path.relative(workspacePathParent, selectableFolderPath), |
| 121 | path: selectableFolderPath, |
| 122 | picked: prePickedFolders?.has(selectableFolderPath), |
| 123 | } satisfies vs.QuickPickItem & { path: string }; |
| 124 | }).filter(notUndefined); |
| 125 | |
| 126 | const selectedFolders = await vs.window.showQuickPick(items, { placeHolder, canPickMany: true }); |
| 127 | return selectedFolders?.map((folder) => folder.path); |
| 128 | } |
no test coverage detected