浏览代码

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
)[];

正在加载...
取消
保存