From b911fc9127cb5e6be14ae0f11e67b30c3ce1a755 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Fri, 13 Dec 2019 08:45:40 -0800 Subject: [PATCH] Sorts origin to top when selecting remotes (fixes #924) Usually I want to, for instance, copy the URL to a commit on the origin, even if I have other remotes from forks. This adds a sort to show the origin at the top of the remotes list by default --- src/quickpicks/remotesQuickPick.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/quickpicks/remotesQuickPick.ts b/src/quickpicks/remotesQuickPick.ts index fb7fcca..7954aaa 100644 --- a/src/quickpicks/remotesQuickPick.ts +++ b/src/quickpicks/remotesQuickPick.ts @@ -142,7 +142,10 @@ export class RemotesQuickPick { clipboard?: boolean, goBackCommand?: CommandQuickPickItem ): Promise { - const items = remotes.map(r => new OpenRemoteCommandQuickPickItem(r, resource, clipboard)) as ( + const items = remotes + // show the origin as the top, 'default' pick + .sort(r => (r.name === 'origin' ? -1 : 0)) + .map(r => new OpenRemoteCommandQuickPickItem(r, resource, clipboard)) as ( | OpenRemoteCommandQuickPickItem | CommandQuickPickItem )[];