瀏覽代碼

Removes reveal/search from commit quickpick items

In favor of the same options as buttons on the commit item itself
main
Eric Amodio 2 年之前
父節點
當前提交
8c01c228a7
共有 2 個檔案被更改,包括 2 行新增84 行删除
  1. +1
    -22
      src/commands/quickCommand.steps.ts
  2. +1
    -62
      src/quickpicks/quickPicksItems.ts

+ 1
- 22
src/commands/quickCommand.steps.ts 查看文件

@ -60,8 +60,6 @@ import {
ReferencesQuickPickItem,
RefQuickPickItem,
RepositoryQuickPickItem,
RevealInSideBarQuickPickItem,
SearchForCommitQuickPickItem,
TagQuickPickItem,
} from '../quickpicks';
import { Arrays, Iterables, Strings } from '../system';
@ -1468,12 +1466,7 @@ async function getShowCommitOrStashStepItems<
const items: (CommandQuickPickItem | QuickPickSeparator)[] = [new CommitFilesQuickPickItem(state.reference)];
if (GitCommit.isStash(state.reference)) {
items.push(
QuickPickSeparator.create(),
new RevealInSideBarQuickPickItem(state.reference),
QuickPickSeparator.create(),
new CommitCopyMessageQuickPickItem(state.reference),
);
items.push(QuickPickSeparator.create(), new CommitCopyMessageQuickPickItem(state.reference));
items.push(
QuickPickSeparator.create('Actions'),
@ -1496,12 +1489,6 @@ async function getShowCommitOrStashStepItems<
}),
);
} else {
items.push(
QuickPickSeparator.create(),
new RevealInSideBarQuickPickItem(state.reference),
new SearchForCommitQuickPickItem(state.reference),
);
const remotes = await Container.instance.git.getRemotesWithProviders(state.repo.path, { sort: true });
if (remotes?.length) {
items.push(
@ -1836,18 +1823,10 @@ async function getShowCommitOrStashFileStepItems<
if (GitCommit.isStash(state.reference)) {
items.push(
QuickPickSeparator.create(),
new RevealInSideBarQuickPickItem(state.reference),
QuickPickSeparator.create(),
new CommitCopyMessageQuickPickItem(state.reference),
QuickPickSeparator.create('Actions'),
);
} else {
items.push(
QuickPickSeparator.create(),
new RevealInSideBarQuickPickItem(state.reference),
new SearchForCommitQuickPickItem(state.reference),
);
const remotes = await Container.instance.git.getRemotesWithProviders(state.repo.path, { sort: true });
if (remotes?.length) {
items.push(

+ 1
- 62
src/quickpicks/quickPicksItems.ts 查看文件

@ -1,8 +1,5 @@
import { commands, QuickPickItem, QuickPickItemKind } from 'vscode';
import { Commands, GitActions } from '../commands';
import { Container } from '../container';
import { GitCommit, GitReference, GitRevisionReference } from '../git/models';
import { SearchPattern } from '../git/search';
import { Commands } from '../commands';
import { Keys } from '../keyboard';
declare module 'vscode' {
@ -196,61 +193,3 @@ function hasFlags(flags: T[], has?: T | T[]): boolean {
return has.length === 0 ? flags.length === 0 : has.every(f => flags.includes(f));
}
export class RevealInSideBarQuickPickItem extends CommandQuickPickItem {
constructor(
private readonly reference: GitRevisionReference,
item: QuickPickItem = {
label: `$(eye) Reveal ${GitReference.isStash(reference) ? 'Stash' : 'Commit'} in Side Bar`,
description: GitReference.isStash(reference) ? '' : 'can take a while',
},
) {
super(item, undefined, undefined);
}
override async execute(options?: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
if (GitCommit.isStash(this.reference)) {
void (await GitActions.Stash.reveal(this.reference, {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
}));
} else {
void (await GitActions.Commit.reveal(this.reference, {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
}));
}
}
}
export class SearchForCommitQuickPickItem extends CommandQuickPickItem {
constructor(
private readonly reference: GitRevisionReference,
item: QuickPickItem = {
label: '$(search) Search for Commit in Side Bar',
},
) {
super(item, undefined, undefined);
}
override async execute(options?: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
void (await Container.instance.searchAndCompareView.search(
this.reference.repoPath,
{
pattern: SearchPattern.fromCommit(this.reference),
},
{
label: {
label: `for ${GitReference.toString(this.reference, { icon: false })}`,
},
reveal: {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
},
},
));
}
}

Loading…
取消
儲存