Skip to content

Commit 53bbba0

Browse files
authored
Merge pull request microsoft#94968 from jeanp413/fix-94323
Fixes rename preview "Group Changes By File" view doesn't show the reference type icon info
2 parents c139d3b + fca6ad4 commit 53bbba0

2 files changed

Lines changed: 48 additions & 4 deletions

File tree

src/vs/workbench/contrib/bulkEdit/browser/bulkEdit.css

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,32 @@
5353
align-items: center;
5454
}
5555

56-
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .theme-icon {
56+
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .theme-icon,
57+
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .theme-icon {
5758
margin-right: 4px;
5859
}
5960

60-
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .uri-icon {
61+
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
62+
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon {
6163
background-repeat: no-repeat;
6264
background-image: var(--background-light);
6365
background-position: left center;
6466
background-size: contain;
6567
margin-right: 4px;
6668
height: 100%;
6769
width: 16px;
70+
min-width: 16px;
6871
}
6972

7073
.vs-dark .monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
71-
.hc-black .monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .uri-icon
74+
.hc-black .monaco-workbench .bulk-edit-panel .monaco-tl-contents.category .uri-icon,
75+
.vs-dark .monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon,
76+
.hc-black .monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .uri-icon
7277
{
7378
background-image: var(--background-dark);
7479
}
80+
81+
.monaco-workbench .bulk-edit-panel .monaco-tl-contents.textedit .monaco-highlighted-label {
82+
overflow: hidden;
83+
text-overflow: ellipsis;
84+
}

src/vs/workbench/contrib/bulkEdit/browser/bulkEditTree.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,17 +525,22 @@ class TextEditElementTemplate {
525525
private readonly _localDisposables = new DisposableStore();
526526

527527
private readonly _checkbox: HTMLInputElement;
528+
private readonly _icon: HTMLDivElement;
528529
private readonly _label: HighlightedLabel;
529530

530531
constructor(container: HTMLElement) {
532+
container.classList.add('textedit');
533+
531534
this._checkbox = document.createElement('input');
532535
this._checkbox.className = 'edit-checkbox';
533536
this._checkbox.type = 'checkbox';
534537
this._checkbox.setAttribute('role', 'checkbox');
535538
container.appendChild(this._checkbox);
536539

540+
this._icon = document.createElement('div');
541+
container.appendChild(this._icon);
542+
537543
this._label = new HighlightedLabel(container, false);
538-
dom.addClass(this._label.element, 'textedit');
539544
}
540545

541546
dispose(): void {
@@ -575,7 +580,36 @@ class TextEditElementTemplate {
575580
title = metadata.label;
576581
}
577582

583+
const iconPath = metadata?.iconPath;
584+
if (!iconPath) {
585+
this._icon.style.display = 'none';
586+
} else {
587+
this._icon.style.display = 'block';
588+
589+
this._icon.style.setProperty('--background-dark', null);
590+
this._icon.style.setProperty('--background-light', null);
591+
592+
if (ThemeIcon.isThemeIcon(iconPath)) {
593+
// css
594+
const className = ThemeIcon.asClassName(iconPath);
595+
this._icon.className = className ? `theme-icon ${className}` : '';
596+
597+
} else if (URI.isUri(iconPath)) {
598+
// background-image
599+
this._icon.className = 'uri-icon';
600+
this._icon.style.setProperty('--background-dark', `url("${iconPath.toString(true)}")`);
601+
this._icon.style.setProperty('--background-light', `url("${iconPath.toString(true)}")`);
602+
603+
} else {
604+
// background-image
605+
this._icon.className = 'uri-icon';
606+
this._icon.style.setProperty('--background-dark', `url("${iconPath.dark.toString(true)}")`);
607+
this._icon.style.setProperty('--background-light', `url("${iconPath.light.toString(true)}")`);
608+
}
609+
}
610+
578611
this._label.set(value, [selectHighlight, insertHighlight], title, true);
612+
this._icon.title = title || '';
579613
}
580614
}
581615

0 commit comments

Comments
 (0)