Change:
Testing Have remote commits. Click on a remote commit to view the commit Use the commit menu to view the commit Expected: Focus shifts to the already opened editor Actual: New diff editor opened for the commit. !

Discussion:
], "scm/historyItem/context": [ { <del> "command": "git.viewCommit", "when": "scmProvider == git && config.multiDiffEditor.experimental.enabled", "group": "1_view@1" }, { </del> "command": "git.copyCommitId", "when": "scmProvider == git && !listMultiSelection", <del> "group": "3_copy@1" </del> <ins> "group": "1_copy@1" </ins> }, { "command": "git.copyCommitMessage", "when": "scmProvider == git && !listMultiSelection", <del> "group": "3_copy@2" </del> <ins> "group": "1_copy@2" </ins> } ], "scm/incomingChanges": [

const selection = this.getSelectedHistoryItems(); const contextIsSelected = selection.some(s => s === context); if (contextIsSelected && selection.length > 1) { <del> args.push(...[selection[0], selection[selection.length - 1]] .map(h => ( { id: h.historyItemViewModel.historyItem.id, parentIds: h.historyItemViewModel.historyItem.parentIds, message: h.historyItemViewModel.historyItem.message, author: h.historyItemViewModel.historyItem.author, icon: h.historyItemViewModel.historyItem.icon, timestamp: h.historyItemViewModel.historyItem.timestamp, statistics: h.historyItemViewModel.historyItem.statistics, } satisfies ISCMHistoryItem))); </del> <ins> args.push(...selection.map(h => ( { id: h.historyItemViewModel.historyItem.id, parentIds: h.historyItemViewModel.historyItem.parentIds, message: h.historyItemViewModel.historyItem.message, author: h.historyItemViewModel.historyItem.author, icon: h.historyItemViewModel.historyItem.icon, timestamp: h.historyItemViewModel.historyItem.timestamp, statistics: h.historyItemViewModel.historyItem.statistics, } satisfies ISCMHistoryItem))); </ins> } else { args.push({ id: context.historyItemViewModel.historyItem.id,

} }); <ins> registerAction2(class extends Action2 { constructor() { super({ id: 'workbench.scm.action.scm.viewChanges', title: localize('viewChanges', "View Changes"), f1: false, menu: [ { id: MenuId.SCMChangesContext, group: '0_view', when: ContextKeyExpr.equals('config.multiDiffEditor.experimental.enabled', true) } ] }); } override async run(accessor: ServicesAccessor, provider: ISCMProvider, ...historyItems: ISCMHistoryItem[]) { const commandService = accessor.get(ICommandService); if (!provider || historyItems.length === 0) { return; } const historyItem = historyItems[0]; const historyItemLast = historyItems[historyItems.length - 1]; const historyProvider = provider.historyProvider.get(); if (historyItems.length > 1) { const ancestor = await historyProvider?.resolveHistoryItemGroupCommonAncestor2([historyItem.id, historyItemLast.id]); if (!ancestor || (ancestor !== historyItem.id && ancestor !== historyItemLast.id)) { return; } } const historyItemParentId = historyItemLast.parentIds.length > 0 ? historyItemLast.parentIds[0] : undefined; const historyItemChanges = await historyProvider?.provideHistoryItemChanges(historyItem.id, historyItemParentId); if (!historyItemChanges?.length) { return; } const title = historyItems.length === 1 ? `${historyItems[0].id.substring(0, 8)} - ${historyItems[0].message}` : localize('historyItemChangesEditorTitle', "All Changes ({0} ↔ {1})", historyItem.id.substring(0, 8), historyItemLast.id.substring(0, 8)); const rootUri = provider.rootUri; const multiDiffSourceUri = rootUri ? rootUri.with({ scheme: 'scm-history-item', path: `${rootUri.path}/${historyItem.id}..${historyItemParentId}` }) : URI.from({ scheme: 'scm-history-item', path: `${provider.label}/${historyItem.id}..${historyItemParentId}` }, true); commandService.executeCommand('_workbench.openMultiDiffEditor', { title, multiDiffSourceUri, resources: historyItemChanges }); } }); </ins> class RepositoryVisibilityAction extends Action2 { private repository: ISCMRepository;

const rootUri = e.element.repository.provider.rootUri; const multiDiffSourceUri = rootUri ? <del> rootUri.with({ scheme: 'scm-history-item', path: `${rootUri.path}/${historyItem.id}` }) : { scheme: 'scm-history-item', path: `${e.element.repository.provider.label}/${historyItem.id}` }; </del> <ins> rootUri.with({ scheme: 'scm-history-item', path: `${rootUri.path}/${historyItem.id}..${historyItemParentId}` }) : URI.from({ scheme: 'scm-history-item', path: `${e.element.repository.provider.label}/${historyItem.id}..${historyItemParentId}` }, true); </ins> await this.commandService.executeCommand('_workbench.openMultiDiffEditor', { title, multiDiffSourceUri, resources: historyItemChanges }); }