mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Git - improve graph/timeline/blame hover rendering (#273932)
This commit is contained in:
@@ -639,28 +639,47 @@ export function getHistoryItemHover(authorAvatar: string | undefined, authorName
|
||||
enabledCommands: commands?.flat().map(c => c.command) ?? []
|
||||
};
|
||||
|
||||
// Author
|
||||
if (authorName) {
|
||||
const avatar = authorAvatar ? `` : '$(account)';
|
||||
|
||||
if (authorEmail) {
|
||||
const emailTitle = l10n.t('Email');
|
||||
markdownString.appendMarkdown(`${avatar} [**${authorName}**](mailto:${authorEmail} "${emailTitle} ${authorName}")`);
|
||||
// Avatar
|
||||
if (authorAvatar) {
|
||||
markdownString.appendMarkdown(';
|
||||
markdownString.appendText(authorAvatar);
|
||||
markdownString.appendMarkdown(`|width=${AVATAR_SIZE},height=${AVATAR_SIZE})`);
|
||||
} else {
|
||||
markdownString.appendMarkdown(`${avatar} **${authorName}**`);
|
||||
markdownString.appendMarkdown('$(account)');
|
||||
}
|
||||
|
||||
if (authorDate) {
|
||||
// Email
|
||||
if (authorEmail) {
|
||||
markdownString.appendMarkdown(' [**');
|
||||
markdownString.appendText(authorName);
|
||||
markdownString.appendMarkdown('**](mailto:');
|
||||
markdownString.appendText(authorEmail);
|
||||
markdownString.appendMarkdown(')');
|
||||
} else {
|
||||
markdownString.appendMarkdown(' **');
|
||||
markdownString.appendText(authorName);
|
||||
markdownString.appendMarkdown('**');
|
||||
}
|
||||
|
||||
// Date
|
||||
if (authorDate && !isNaN(new Date(authorDate).getTime())) {
|
||||
const dateString = new Date(authorDate).toLocaleString(undefined, {
|
||||
year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric'
|
||||
});
|
||||
markdownString.appendMarkdown(`, $(history) ${fromNow(authorDate, true, true)} (${dateString})`);
|
||||
|
||||
markdownString.appendMarkdown(', $(history)');
|
||||
markdownString.appendText(` ${fromNow(authorDate, true, true)} (${dateString})`);
|
||||
}
|
||||
|
||||
markdownString.appendMarkdown('\n\n');
|
||||
}
|
||||
|
||||
// Subject | Message
|
||||
markdownString.appendMarkdown(`${emojify(message.replace(/\r\n|\r|\n/g, '\n\n'))}\n\n`);
|
||||
// Subject | Message (escape image syntax)
|
||||
markdownString.appendMarkdown(`${emojify(message.replace(/!\[/g, '![').replace(/\r\n|\r|\n/g, '\n\n'))}\n\n`);
|
||||
markdownString.appendMarkdown(`---\n\n`);
|
||||
|
||||
// Short stats
|
||||
|
||||
Reference in New Issue
Block a user