Git - add author email to the blame/graph hover (#237360)

pull/183155/merge
Ladislau Szomoru 2025-01-06 20:31:52 +01:00 committed by GitHub
parent 3b92e71162
commit abe43ed1d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 3 deletions

View File

@ -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' });

View File

@ -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(),

View File

@ -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;

View File

@ -459,10 +459,14 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
const historyItem = element.historyItemViewModel.historyItem;
const markdown = new MarkdownString('', { isTrusted: true, supportThemeIcons: true });
// markdown.appendMarkdown(`$(git-commit) \`${historyItem.displayId ?? historyItem.id}\`\n\n`);
if (historyItem.author) {
markdown.appendMarkdown(`$(account) **${historyItem.author}**`);
if (historyItem.authorEmail) {
const emailTitle = localize('emailLinkTitle', "Email");
markdown.appendMarkdown(`$(account) [**${historyItem.author}**](mailto:${historyItem.authorEmail} "${emailTitle} ${historyItem.author}")`);
} else {
markdown.appendMarkdown(`$(account) **${historyItem.author}**`);
}
if (historyItem.timestamp) {
const dateFormatter = safeIntl.DateTimeFormat(platform.language, { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' });

View File

@ -63,6 +63,7 @@ export interface ISCMHistoryItem {
readonly message: string;
readonly displayId?: string;
readonly author?: string;
readonly authorEmail?: string;
readonly timestamp?: number;
readonly statistics?: ISCMHistoryItemStatistics;
readonly references?: ISCMHistoryItemRef[];

View File

@ -51,6 +51,7 @@ declare module 'vscode' {
readonly message: string;
readonly displayId?: string;
readonly author?: string;
readonly authorEmail?: string;
readonly timestamp?: number;
readonly statistics?: SourceControlHistoryItemStatistics;
readonly references?: SourceControlHistoryItemRef[];