Skip to content

Commit 8311b0d

Browse files
committed
simplify publish to github name picker
1 parent 5effa18 commit 8311b0d

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

src/commands.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -590,37 +590,32 @@ export function registerGlobalCommands(context: vscode.ExtensionContext, gitAPI:
590590
const repo = sanitizeRepositoryName(quickpick.value);
591591

592592
if (!repo) {
593-
return;
594-
}
595-
596-
try {
597-
quickpick.busy = true;
598-
await hub.octokit.repos.get({ owner, repo: repo });
599-
quickpick.items = [{ label: `$(error) Repository already exists`, description: `$(github) ${owner}/${repo}`, alwaysShow: true }];
600-
} catch {
593+
quickpick.items = [];
594+
} else {
601595
quickpick.items = [{ label: `$(repo) Create private repository`, description: `$(github) ${owner}/${repo}`, alwaysShow: true, repo: repo }];
602-
} finally {
603-
quickpick.busy = false;
604596
}
605597
};
606598

607-
const debouncedOnDidChangeValue = debounce(throttle(onDidChangeValue), 300);
608599
quickpick.value = folder.name;
609600
onDidChangeValue();
610601

611602
while (true) {
612-
const listener = quickpick.onDidChangeValue(() => {
613-
quickpick.items = [];
614-
debouncedOnDidChangeValue();
615-
});
616-
603+
const listener = quickpick.onDidChangeValue(onDidChangeValue);
617604
const pick = await getPick(quickpick);
618605
listener.dispose();
619606

620607
repo = pick?.repo;
621608

622609
if (repo) {
623-
break;
610+
try {
611+
quickpick.busy = true;
612+
await hub.octokit.repos.get({ owner, repo: repo });
613+
quickpick.items = [{ label: `$(error) Repository already exists`, description: `$(github) ${owner}/${repo}`, alwaysShow: true }];
614+
} catch {
615+
break;
616+
} finally {
617+
quickpick.busy = false;
618+
}
624619
}
625620
}
626621

0 commit comments

Comments
 (0)