Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion build/lib/stylelint/vscode-known-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@
"--vscode-quickInputList-focusIconForeground",
"--vscode-quickInputTitle-background",
"--vscode-sash-hoverBorder",
"--vscode-scm-historyItemAdditionsForeground",
"--vscode-scm-historyItemDeletionsForeground",
"--vscode-scm-historyItemStatisticsBorder",
"--vscode-scrollbar-shadow",
"--vscode-scrollbarSlider-activeBackground",
"--vscode-scrollbarSlider-background",
Expand Down Expand Up @@ -789,4 +792,4 @@
"--z-index-notebook-sticky-scroll",
"--zoom-factor"
]
}
}
48 changes: 14 additions & 34 deletions src/vs/workbench/contrib/scm/browser/media/scm.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,50 +154,30 @@
font-size: 11px;
line-height: 11px;
margin-left: 6px;
color: var(--vscode-badge-foreground);
gap: 4px;
}

.scm-view .monaco-list .monaco-list-row.focused .history-item .stats-container,
.scm-view .monaco-list .monaco-list-row.selected .history-item .stats-container,
.scm-view .monaco-list .monaco-list-row.focused .history-item .stats-container .monaco-icon-label .codicon,
.scm-view .monaco-list .monaco-list-row.selected .history-item .stats-container .monaco-icon-label .codicon {
color: var(--vscode-badge-foreground);
}

.scm-view .monaco-list-row .history-item .stats-container .monaco-icon-label {
.scm-view .monaco-list-row .history-item .stats-container {
min-height: 18px;
padding: 0 2px;
padding: 0 4px;
border-radius: 2px;
border: 1px solid var(--vscode-contrastBorder);
background-color: var(--vscode-badge-background);
border: 1px solid var(--vscode-scm-historyItemStatisticsBorder);
}

.scm-view .monaco-list-row .history-item .stats-container .monaco-icon-label .codicon {
color: var(--vscode-badge-foreground);
margin: 0 1px;
}

.scm-view .monaco-list-row .history-item .stats-container .monaco-icon-label .codicon.codicon-diff-added,
.scm-view .monaco-list-row.focused .history-item .stats-container .monaco-icon-label .codicon.codicon-diff-added,
.scm-view .monaco-list-row.selected .history-item .stats-container .monaco-icon-label .codicon.codicon-diff-added {
color: var(--vscode-editorGutter-addedBackground);
margin-top: 1px;
}

.scm-view .monaco-list-row .history-item .stats-container .monaco-icon-label .codicon.codicon-diff-removed,
.scm-view .monaco-list-row.focused .history-item .stats-container .monaco-icon-label .codicon.codicon-diff-removed,
.scm-view .monaco-list-row.selected .history-item .stats-container .monaco-icon-label .codicon.codicon-diff-removed {
color: var(--vscode-editorGutter-deletedBackground);
margin-top: 1px;
}

.scm-view .monaco-list-row .history-item .stats-container .monaco-icon-label .monaco-highlighted-label {
.scm-view .monaco-list-row .history-item .stats-container > .files-label,
.scm-view .monaco-list-row .history-item .stats-container > .insertions-label,
.scm-view .monaco-list-row .history-item .stats-container > .deletions-label {
display: flex;
align-items: center;
opacity: 0.75;
}

.scm-view .monaco-list-row .history-item .stats-container .codicon {
font-size: 11px;
.scm-view .monaco-list-row .history-item .stats-container > .insertions-label {
color: var(--vscode-scm-historyItemAdditionsForeground);
}

.scm-view .monaco-list-row .history-item .stats-container > .deletions-label {
color: var(--vscode-scm-historyItemDeletionsForeground);
}

.scm-view .monaco-list-row .history-item .monaco-icon-label .icon-container {
Expand Down
56 changes: 43 additions & 13 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'
import { EditOperation } from 'vs/editor/common/core/editOperation';
import { stripIcons } from 'vs/base/common/iconLabels';
import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';

// type SCMResourceTreeNode = IResourceNode<ISCMResource, ISCMResourceGroup>;
// type SCMHistoryItemChangeResourceTreeNode = IResourceNode<SCMHistoryItemChangeTreeElement, SCMHistoryItemTreeElement>;
Expand All @@ -116,6 +117,28 @@ type TreeElement =
IResourceNode<SCMHistoryItemChangeTreeElement, SCMHistoryItemTreeElement> |
SCMViewSeparatorElement;

registerColor('scm.historyItemAdditionsForeground', {
dark: 'gitDecoration.addedResourceForeground',
light: 'gitDecoration.addedResourceForeground',
hcDark: 'gitDecoration.addedResourceForeground',
hcLight: 'gitDecoration.addedResourceForeground'
}, localize('scm.historyItemAdditionsForeground', "History item additions foreground color."));

registerColor('scm.historyItemDeletionsForeground', {
dark: 'gitDecoration.deletedResourceForeground',
light: 'gitDecoration.deletedResourceForeground',
hcDark: 'gitDecoration.deletedResourceForeground',
hcLight: 'gitDecoration.deletedResourceForeground'
}, localize('scm.historyItemDeletionsForeground', "History item deletions foreground color."));

registerColor('scm.historyItemStatisticsBorder', {
dark: transparent('foreground', 0.1),
light: transparent('foreground', 0.1),
hcDark: transparent('foreground', 0.1),
hcLight: transparent('foreground', 0.1)
}, localize('scm.historyItemStatisticsBorder', "History item statistics border color."));


interface ISCMLayout {
height: number | undefined;
width: number | undefined;
Expand Down Expand Up @@ -735,7 +758,9 @@ interface HistoryItemTemplate {
readonly iconContainer: HTMLElement;
readonly label: IconLabel;
readonly statsContainer: HTMLElement;
readonly statsLabel: IconLabel;
readonly filesLabel: HTMLElement;
readonly insertionsLabel: HTMLElement;
readonly deletionsLabel: HTMLElement;
readonly actionBar: ActionBar;
readonly elementDisposables: DisposableStore;
readonly disposables: IDisposable;
Expand Down Expand Up @@ -765,9 +790,11 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
disposables.add(actionBar);

const statsContainer = append(element, $('.stats-container'));
const statsLabel = new IconLabel(statsContainer, { supportIcons: true });
const filesLabel = append(statsContainer, $('.files-label'));
const insertionsLabel = append(statsContainer, $('.insertions-label'));
const deletionsLabel = append(statsContainer, $('.deletions-label'));

return { iconContainer, label: iconLabel, actionBar, statsContainer, statsLabel, elementDisposables: new DisposableStore(), disposables };
return { iconContainer, label: iconLabel, actionBar, statsContainer, filesLabel, insertionsLabel, deletionsLabel, elementDisposables: new DisposableStore(), disposables };
}

renderElement(node: ITreeNode<SCMHistoryItemTreeElement, void>, index: number, templateData: HistoryItemTemplate, height: number | undefined): void {
Expand Down Expand Up @@ -798,32 +825,35 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
private renderStatistics(node: ITreeNode<SCMHistoryItemTreeElement, void>, index: number, templateData: HistoryItemTemplate, height: number | undefined): void {
const historyItem = node.element;

if (historyItem.statistics?.files || historyItem.statistics?.insertions || historyItem.statistics?.deletions) {
const statsLabelTitle: string[] = [];

const filesLabel = historyItem.statistics?.files ? `${historyItem.statistics.files}$(files)` : '';
const insertionsLabel = historyItem.statistics?.insertions ? ` ${historyItem.statistics.insertions}$(diff-added)` : '';
const deletionsLabel = historyItem.statistics?.deletions ? ` ${historyItem.statistics.deletions}$(diff-removed)` : '';
if (historyItem.statistics) {
const statsAriaLabel: string[] = [];

if (historyItem.statistics?.files) {
const filesDescription = historyItem.statistics.files === 1 ?
localize('fileChanged', "file changed") : localize('filesChanged', "files changed");
statsLabelTitle.push(`${historyItem.statistics.files} ${filesDescription}`);
statsAriaLabel.push(`${historyItem.statistics.files} ${filesDescription}`);
}

if (historyItem.statistics?.insertions) {
const insertionsDescription = historyItem.statistics.insertions === 1 ?
localize('insertion', "insertion{0}", '(+)') : localize('insertions', "insertions{0}", '(+)');
statsLabelTitle.push(`${historyItem.statistics.insertions} ${insertionsDescription}`);
statsAriaLabel.push(`${historyItem.statistics.insertions} ${insertionsDescription}`);
}

if (historyItem.statistics?.deletions) {
const deletionsDescription = historyItem.statistics.deletions === 1 ?
localize('deletion', "deletion{0}", '(-)') : localize('deletions', "deletions{0}", '(-)');
statsLabelTitle.push(`${historyItem.statistics.deletions} ${deletionsDescription}`);
statsAriaLabel.push(`${historyItem.statistics.deletions} ${deletionsDescription}`);
}

templateData.statsLabel.setLabel(`${filesLabel}${insertionsLabel}${deletionsLabel}`, undefined, { title: statsLabelTitle.join(', ') });
const statsTitle = statsAriaLabel.join(', ');
templateData.statsContainer.title = statsTitle;
templateData.statsContainer.setAttribute('aria-label', statsTitle);

templateData.filesLabel.textContent = historyItem.statistics.files > 0 ? historyItem.statistics.files.toString() : '';
templateData.insertionsLabel.textContent = historyItem.statistics.insertions > 0 ? `+${historyItem.statistics.insertions}` : '';
templateData.deletionsLabel.textContent = historyItem.statistics.deletions > 0 ? `-${historyItem.statistics.deletions}` : '';

templateData.statsContainer.style.display = '';
} else {
templateData.statsContainer.style.display = 'none';
Expand Down