Browse Source

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
main
Connor Peet 5 years ago
committed by Eric Amodio
parent
commit
b911fc9127
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/quickpicks/remotesQuickPick.ts

+ 4
- 1
src/quickpicks/remotesQuickPick.ts View File

@ -142,7 +142,10 @@ export class RemotesQuickPick {
clipboard?: boolean,
goBackCommand?: CommandQuickPickItem
): Promise<OpenRemoteCommandQuickPickItem | CommandQuickPickItem | undefined> {
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
)[];

Loading…
Cancel
Save