瀏覽代碼

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 年之前
committed by Eric Amodio
父節點
當前提交
b911fc9127
共有 1 個檔案被更改,包括 4 行新增1 行删除
  1. +4
    -1
      src/quickpicks/remotesQuickPick.ts

+ 4
- 1
src/quickpicks/remotesQuickPick.ts 查看文件

@ -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…
取消
儲存