Skip to content

Commit 493a815

Browse files
Alex Rosssourcegraph-bot
authored andcommitted
vscode: Use CSS variables over registerThemingParticipant in tree view (#167943)
Commit: 0370522ed332abb80172b7a043042c3830706497
1 parent 1a48df2 commit 493a815

File tree

2 files changed

+9
-29
lines changed

2 files changed

+9
-29
lines changed

vscode/src/vs/workbench/browser/parts/views/media/views.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717

1818
/* Misc */
1919

20+
.file-icon-themable-tree .monaco-list-row .content .monaco-highlighted-label .highlight,
21+
.monaco-tl-contents .monaco-highlighted-label .highlight {
22+
color: unset !important;
23+
background-color: var(--vscode-list-filterMatchBackground);
24+
border: 1px dotted var(--vscode-list-filterMatchBorder);
25+
box-sizing: border-box;
26+
}
27+
2028
.monaco-workbench .tree-explorer-viewlet-tree-view {
2129
height: 100%;
2230
}

vscode/src/vs/workbench/browser/parts/views/treeView.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
5050
import { IProgressService } from 'vs/platform/progress/common/progress';
5151
import { Registry } from 'vs/platform/registry/common/platform';
5252
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
53-
import { focusBorder, listFilterMatchHighlight, listFilterMatchHighlightBorder, textCodeBlockBackground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
5453
import { ColorScheme } from 'vs/platform/theme/common/theme';
55-
import { FileThemeIcon, FolderThemeIcon, IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
54+
import { FileThemeIcon, FolderThemeIcon, IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
5655
import { DraggedTreeItemsIdentifier, fillEditorsDragData, LocalSelectionTransfer } from 'vs/workbench/browser/dnd';
5756
import { IResourceLabel, ResourceLabels } from 'vs/workbench/browser/labels';
5857
import { API_OPEN_DIFF_EDITOR_COMMAND_ID, API_OPEN_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
@@ -1005,33 +1004,6 @@ class TreeDataSource implements IAsyncDataSource<ITreeItem, ITreeItem> {
10051004
}
10061005
}
10071006

1008-
// todo@jrieken,sandy make this proper and contributable from extensions
1009-
registerThemingParticipant((theme, collector) => {
1010-
1011-
const matchBackgroundColor = theme.getColor(listFilterMatchHighlight);
1012-
if (matchBackgroundColor) {
1013-
collector.addRule(`.file-icon-themable-tree .monaco-list-row .content .monaco-highlighted-label .highlight { color: unset !important; background-color: ${matchBackgroundColor}; }`);
1014-
collector.addRule(`.monaco-tl-contents .monaco-highlighted-label .highlight { color: unset !important; background-color: ${matchBackgroundColor}; }`);
1015-
}
1016-
const matchBorderColor = theme.getColor(listFilterMatchHighlightBorder);
1017-
if (matchBorderColor) {
1018-
collector.addRule(`.file-icon-themable-tree .monaco-list-row .content .monaco-highlighted-label .highlight { color: unset !important; border: 1px dotted ${matchBorderColor}; box-sizing: border-box; }`);
1019-
collector.addRule(`.monaco-tl-contents .monaco-highlighted-label .highlight { color: unset !important; border: 1px dotted ${matchBorderColor}; box-sizing: border-box; }`);
1020-
}
1021-
const link = theme.getColor(textLinkForeground);
1022-
if (link) {
1023-
collector.addRule(`.tree-explorer-viewlet-tree-view > .message a { color: ${link}; }`);
1024-
}
1025-
const focusBorderColor = theme.getColor(focusBorder);
1026-
if (focusBorderColor) {
1027-
collector.addRule(`.tree-explorer-viewlet-tree-view > .message a:focus { outline: 1px solid ${focusBorderColor}; outline-offset: -1px; }`);
1028-
}
1029-
const codeBackground = theme.getColor(textCodeBlockBackground);
1030-
if (codeBackground) {
1031-
collector.addRule(`.tree-explorer-viewlet-tree-view > .message code { background-color: ${codeBackground}; }`);
1032-
}
1033-
});
1034-
10351007
interface ITreeExplorerTemplateData {
10361008
readonly elementDisposable: DisposableStore;
10371009
readonly container: HTMLElement;

0 commit comments

Comments
 (0)