Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,38 @@ registerAction2(class extends Action2 {
});
}

override async run(accessor: ServicesAccessor, historyItem: ISCMHistoryItem, historyItemChange: ISCMHistoryItemChange) {
const editorService = accessor.get(IEditorService);

if (!historyItem || !historyItemChange.modifiedUri) {
return;
}

// Open the current (working tree) version of the file, rather than the
// historical snapshot. The historical version is shown when the user
// clicks the row in the graph.
const currentFileUri = URI.file(historyItemChange.modifiedUri.fsPath);
await editorService.openEditor({ resource: currentFileUri });
}
});

registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.scm.action.graph.openFileAtCommit',
title: localize('openFileAtCommit', "Open File at Commit"),
icon: Codicon.history,
f1: false,
menu: [
{
id: MenuId.SCMHistoryItemChangeContext,
group: '0_view',
order: 2
}
]
});
}

override async run(accessor: ServicesAccessor, historyItem: ISCMHistoryItem, historyItemChange: ISCMHistoryItemChange) {
const editorService = accessor.get(IEditorService);

Expand Down