()
| 28 | })); |
| 29 | |
| 30 | export const commandOpenRepository = async () => { |
| 31 | const quickPick = vscode.window.createQuickPick(); |
| 32 | const manualInputItem = { label: '' }; |
| 33 | let recentRepoPickItems = getRecentRepoPickItems(); |
| 34 | |
| 35 | const updatePickerItems = () => { |
| 36 | if (manualInputItem.label) { |
| 37 | return (quickPick.items = [...recentRepoPickItems, manualInputItem]); |
| 38 | } |
| 39 | return (quickPick.items = recentRepoPickItems); |
| 40 | }; |
| 41 | |
| 42 | quickPick.placeholder = 'Select to open...'; |
| 43 | updatePickerItems(); |
| 44 | |
| 45 | quickPick.show(); |
| 46 | quickPick.onDidTriggerItemButton(async (event) => { |
| 47 | if (event.button === repoPickItemButtons[0]) { |
| 48 | await removeRecentRepository(event.item.label); |
| 49 | recentRepoPickItems = getRecentRepoPickItems(); |
| 50 | updatePickerItems(); |
| 51 | } |
| 52 | }); |
| 53 | |
| 54 | quickPick.onDidChangeValue((value) => { |
| 55 | manualInputItem.label = value ? `Open ${value}...` : ''; |
| 56 | updatePickerItems(); |
| 57 | }); |
| 58 | |
| 59 | quickPick.onDidAccept(async () => { |
| 60 | const choice = quickPick.activeItems[0]; |
| 61 | const repository = choice === manualInputItem ? quickPick.value : choice.label; |
| 62 | const targetLink = vscode.Uri.parse((await router.href()) || '').with({ |
| 63 | path: await (await router.resolveParser()).buildTreePath(repository), |
| 64 | }); |
| 65 | vscode.commands.executeCommand('vscode.open', targetLink); |
| 66 | quickPick.hide(); |
| 67 | }); |
| 68 | }; |
| 69 | |
| 70 | const commandOpenOnlineEditor = async () => { |
| 71 | const currentScheme = adapterManager.getCurrentScheme(); |
nothing calls this directly
no test coverage detected