Skip to content

Commit 79f1a95

Browse files
authored
SCM - only show labels for the current/remote/base branches in the hover (microsoft#226879)
1 parent f0ee1cd commit 79f1a95

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
261261
return [];
262262
}
263263

264-
return [currentHistoryItemGroup.name, currentHistoryItemGroup.remote?.name ?? '', currentHistoryItemGroup.base?.name ?? ''];
264+
return [
265+
currentHistoryItemGroup.name,
266+
currentHistoryItemGroup.remote?.name,
267+
currentHistoryItemGroup.base?.name]
268+
.filter(l => l !== undefined);
265269
}
266270

267271
private getTooltip(element: SCMHistoryItemViewModelTreeElement): IManagedHoverTooltipMarkdownString {
@@ -306,15 +310,19 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
306310
}
307311
}
308312

309-
if (historyItem.labels) {
313+
const labels = this.getLabels(element.repository);
314+
const historyItemLabels = (historyItem.labels ?? [])
315+
.filter(l => labels.includes(l.title));
316+
317+
if (historyItemLabels) {
310318
const historyItemGroupLocalColor = colorTheme.getColor(historyItemGroupLocal);
311319
const historyItemGroupRemoteColor = colorTheme.getColor(historyItemGroupRemote);
312320
const historyItemGroupBaseColor = colorTheme.getColor(historyItemGroupBase);
313321

314322
const historyItemGroupHoverLabelForegroundColor = colorTheme.getColor(historyItemGroupHoverLabelForeground);
315323

316324
markdown.appendMarkdown(`\n\n---\n\n`);
317-
markdown.appendMarkdown(historyItem.labels.map(label => {
325+
markdown.appendMarkdown(historyItemLabels.map(label => {
318326
const historyItemGroupHoverLabelBackgroundColor =
319327
label.title === currentHistoryItemGroup?.name ? historyItemGroupLocalColor :
320328
label.title === currentHistoryItemGroup?.remote?.name ? historyItemGroupRemoteColor :

0 commit comments

Comments
 (0)