Skip to content

Commit

Permalink
Fixes #2641 Support search and open file history change
Browse files Browse the repository at this point in the history
  • Loading branch information
oghazi authored and oghazi committed Jul 7, 2023
1 parent 7ea2046 commit 5eca70e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/commands/quickCommand.buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ export const ShowDetailsViewQuickInputButton: QuickInputButton = {
tooltip: 'Open Details',
};

export const OpenChangesViewQuickInputButton: QuickInputButton = {
iconPath: new ThemeIcon('compare-changes'),
tooltip: 'Open Changes',
};

export const ShowResultsInSideBarQuickInputButton: QuickInputButton = {
iconPath: new ThemeIcon('link-external'),
tooltip: 'Show Results in Side Bar',
Expand Down
11 changes: 10 additions & 1 deletion src/commands/quickCommand.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ import {
createPickStep,
endSteps,
LoadMoreQuickInputButton,
OpenChangesViewQuickInputButton,
OpenInNewWindowQuickInputButton,
PickCommitQuickInputButton,
RevealInSideBarQuickInputButton,
Expand Down Expand Up @@ -1055,7 +1056,11 @@ export async function* pickCommitStep<
picked != null &&
(typeof picked === 'string' ? commit.ref === picked : picked.includes(commit.ref)),
{
buttons: [ShowDetailsViewQuickInputButton, RevealInSideBarQuickInputButton],
buttons: [
ShowDetailsViewQuickInputButton,
RevealInSideBarQuickInputButton,
OpenChangesViewQuickInputButton,
],
compact: true,
icon: true,
},
Expand Down Expand Up @@ -1089,6 +1094,7 @@ export async function* pickCommitStep<
],
onDidClickItemButton: (quickpick, button, item) => {
if (CommandQuickPickItem.is(item)) return;
const fileName = `${item.item.file?.path}`;

switch (button) {
case ShowDetailsViewQuickInputButton:
Expand All @@ -1102,6 +1108,9 @@ export async function* pickCommitStep<
expand: true,
});
break;
case OpenChangesViewQuickInputButton:
void CommitActions.openChanges(fileName, item.item, {});
break;
}
},
onDidClickButton: (quickpick, button) => {
Expand Down

0 comments on commit 5eca70e

Please sign in to comment.