From abe43ed1d5257afa420579370cb0b45818e1d89d Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 6 Jan 2025 20:31:52 +0100 Subject: [PATCH] Git - add author email to the blame/graph hover (#237360) --- extensions/git/src/blame.ts | 7 ++++++- extensions/git/src/historyProvider.ts | 1 + src/vs/workbench/api/common/extHost.protocol.ts | 1 + .../workbench/contrib/scm/browser/scmHistoryViewPane.ts | 8 ++++++-- src/vs/workbench/contrib/scm/common/history.ts | 1 + src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts | 1 + 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/blame.ts b/extensions/git/src/blame.ts index 0dbdca92b32..a39781cdc41 100644 --- a/extensions/git/src/blame.ts +++ b/extensions/git/src/blame.ts @@ -227,7 +227,12 @@ export class GitBlameController { markdownString.supportThemeIcons = true; if (blameInformationOrCommit.authorName) { - markdownString.appendMarkdown(`$(account) **${blameInformationOrCommit.authorName}**`); + if (blameInformationOrCommit.authorEmail) { + const emailTitle = l10n.t('Email'); + markdownString.appendMarkdown(`$(account) [**${blameInformationOrCommit.authorName}**](mailto:${blameInformationOrCommit.authorEmail} "${emailTitle} ${blameInformationOrCommit.authorName}")`); + } else { + markdownString.appendMarkdown(`$(account) **${blameInformationOrCommit.authorName}**`); + } if (blameInformationOrCommit.authorDate) { const dateString = new Date(blameInformationOrCommit.authorDate).toLocaleString(undefined, { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }); diff --git a/extensions/git/src/historyProvider.ts b/extensions/git/src/historyProvider.ts index 250cf80560d..b18923d56b7 100644 --- a/extensions/git/src/historyProvider.ts +++ b/extensions/git/src/historyProvider.ts @@ -260,6 +260,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec parentIds: commit.parents, message: emojify(commit.message), author: commit.authorName, + authorEmail: commit.authorEmail, icon: new ThemeIcon('git-commit'), displayId: getCommitShortHash(Uri.file(this.repository.root), commit.hash), timestamp: commit.authorDate?.getTime(), diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 36e385c3e6e..7bccc00f5b9 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1606,6 +1606,7 @@ export interface SCMHistoryItemDto { readonly message: string; readonly displayId?: string; readonly author?: string; + readonly authorEmail?: string; readonly timestamp?: number; readonly statistics?: { readonly files: number; diff --git a/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts index af17ed451bd..1c3f71ac1ca 100644 --- a/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts @@ -459,10 +459,14 @@ class HistoryItemRenderer implements ITreeRenderer