MCPcopy
hub / github.com/conwnet/github1s / commandOpenRepository

Function commandOpenRepository

extensions/github1s/src/commands/global.ts:30–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 }));
29
30export 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
70const commandOpenOnlineEditor = async () => {
71 const currentScheme = adapterManager.getCurrentScheme();

Callers

nothing calls this directly

Calls 8

removeRecentRepositoryFunction · 0.90
getRecentRepoPickItemsFunction · 0.85
updatePickerItemsFunction · 0.85
hrefMethod · 0.80
resolveParserMethod · 0.80
showMethod · 0.65
hideMethod · 0.65
buildTreePathMethod · 0.45

Tested by

no test coverage detected