|
5 | 5 |
|
6 | 6 | import { coalesce } from '../../../../base/common/arrays.js';
|
7 | 7 | import { Codicon } from '../../../../base/common/codicons.js';
|
| 8 | +import { fromNow } from '../../../../base/common/date.js'; |
8 | 9 | import { Disposable } from '../../../../base/common/lifecycle.js';
|
9 | 10 | import { ThemeIcon } from '../../../../base/common/themables.js';
|
10 | 11 | import { URI } from '../../../../base/common/uri.js';
|
@@ -72,24 +73,37 @@ class SCMHistoryItemContext implements IChatContextPickerItem {
|
72 | 73 |
|
73 | 74 | const historyItems = await historyProvider.provideHistoryItems({ historyItemRefs, limit: 100 }) ?? [];
|
74 | 75 |
|
75 |
| - return historyItems.map(historyItem => ({ |
76 |
| - iconClass: ThemeIcon.asClassName(Codicon.gitCommit), |
77 |
| - label: historyItem.subject, |
78 |
| - description: historyItem.displayId ?? historyItem.id, |
79 |
| - asAttachment: () => { |
80 |
| - const historyItemTitle = getHistoryItemEditorTitle(historyItem); |
81 |
| - const multiDiffSourceUri = ScmHistoryItemResolver.getMultiDiffSourceUri(activeRepository.provider, historyItem); |
82 |
| - const attachmentName = `$(${Codicon.repo.id})\u00A0${activeRepository.provider.name}\u00A0$(${Codicon.gitCommit.id})\u00A0${historyItem.displayId ?? historyItem.id}`; |
83 |
| - |
84 |
| - return { |
85 |
| - id: historyItem.id, |
86 |
| - name: attachmentName, |
87 |
| - value: multiDiffSourceUri, |
88 |
| - title: historyItemTitle, |
89 |
| - kind: 'scmHistoryItem' |
90 |
| - } satisfies ISCMHistoryItemVariableEntry; |
| 76 | + return historyItems.map(historyItem => { |
| 77 | + const details = [`${historyItem.displayId ?? historyItem.id}`]; |
| 78 | + if (historyItem.author) { |
| 79 | + details.push(historyItem.author); |
91 | 80 | }
|
92 |
| - }) satisfies IChatContextPickerPickItem); |
| 81 | + if (historyItem.statistics) { |
| 82 | + details.push(`${historyItem.statistics.files} ${localize('files', 'file(s)')}`); |
| 83 | + } |
| 84 | + if (historyItem.timestamp) { |
| 85 | + details.push(fromNow(historyItem.timestamp, true, true)); |
| 86 | + } |
| 87 | + |
| 88 | + return { |
| 89 | + iconClass: ThemeIcon.asClassName(Codicon.gitCommit), |
| 90 | + label: historyItem.subject, |
| 91 | + detail: details.join(`$(${Codicon.circleSmallFilled.id})`), |
| 92 | + asAttachment: () => { |
| 93 | + const historyItemTitle = getHistoryItemEditorTitle(historyItem); |
| 94 | + const multiDiffSourceUri = ScmHistoryItemResolver.getMultiDiffSourceUri(activeRepository.provider, historyItem); |
| 95 | + const attachmentName = `$(${Codicon.repo.id})\u00A0${activeRepository.provider.name}\u00A0$(${Codicon.gitCommit.id})\u00A0${historyItem.displayId ?? historyItem.id}`; |
| 96 | + |
| 97 | + return { |
| 98 | + id: historyItem.id, |
| 99 | + name: attachmentName, |
| 100 | + value: multiDiffSourceUri, |
| 101 | + title: historyItemTitle, |
| 102 | + kind: 'scmHistoryItem' |
| 103 | + } satisfies ISCMHistoryItemVariableEntry; |
| 104 | + } |
| 105 | + } satisfies IChatContextPickerPickItem; |
| 106 | + }); |
93 | 107 | }
|
94 | 108 | };
|
95 | 109 | }
|
|
0 commit comments