From cd9ecf15d38caa8b0ce4e56ffd418b5ea6c19984 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 15 Jun 2018 15:49:14 +0200 Subject: [PATCH] outline - prepare tree classes for move --- .../parts/outline/electron-browser/outlinePanel.ts | 11 +++++++++-- .../parts/outline/electron-browser/outlineTree.ts | 8 +++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts index 797138c7737..84a921916b5 100644 --- a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts +++ b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts @@ -235,6 +235,7 @@ export class OutlinePanel extends ViewletPanel { private _progressBar: ProgressBar; private _tree: WorkbenchTree; private _treeDataSource: OutlineDataSource; + private _treeRenderer: OutlineRenderer; private _treeFilter: OutlineItemFilter; private _treeComparator: OutlineItemComparator; private _treeStates = new LRUCache(10); @@ -348,11 +349,15 @@ export class OutlinePanel extends ViewletPanel { return false; } }; - const renderer = this._instantiationService.createInstance(OutlineRenderer); + + this._treeRenderer = this._instantiationService.createInstance(OutlineRenderer); this._treeDataSource = new OutlineDataSource(); this._treeComparator = new OutlineItemComparator(this._outlineViewState.sortBy); this._treeFilter = new OutlineItemFilter(); - this._tree = this._instantiationService.createInstance(WorkbenchTree, treeContainer, { controller, renderer, dataSource: this._treeDataSource, sorter: this._treeComparator, filter: this._treeFilter }, {}); + this._tree = this._instantiationService.createInstance(WorkbenchTree, treeContainer, { controller, renderer: this._treeRenderer, dataSource: this._treeDataSource, sorter: this._treeComparator, filter: this._treeFilter }, {}); + + this._treeRenderer.renderProblemColors = this._configurationService.getValue(OutlineConfigKeys.problemsColors); + this._treeRenderer.renderProblemBadges = this._configurationService.getValue(OutlineConfigKeys.problemsBadges); this._disposables.push(this._tree, this._input); this._disposables.push(this._outlineViewState.onDidChange(this._onDidChangeUserState, this)); @@ -589,6 +594,8 @@ export class OutlinePanel extends ViewletPanel { this._editorDisposables.push(this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(OutlineConfigKeys.problemsBadges) || e.affectsConfiguration(OutlineConfigKeys.problemsColors)) { + this._treeRenderer.renderProblemColors = this._configurationService.getValue(OutlineConfigKeys.problemsColors); + this._treeRenderer.renderProblemBadges = this._configurationService.getValue(OutlineConfigKeys.problemsBadges); this._tree.refresh(undefined, true); return; } diff --git a/src/vs/workbench/parts/outline/electron-browser/outlineTree.ts b/src/vs/workbench/parts/outline/electron-browser/outlineTree.ts index 862555ac049..794d930a74f 100644 --- a/src/vs/workbench/parts/outline/electron-browser/outlineTree.ts +++ b/src/vs/workbench/parts/outline/electron-browser/outlineTree.ts @@ -22,7 +22,6 @@ import { MarkerSeverity } from 'vs/platform/markers/common/markers'; import { listErrorForeground, listWarningForeground } from 'vs/platform/theme/common/colorRegistry'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { OutlineConfigKeys } from 'vs/workbench/parts/outline/electron-browser/outline'; export enum OutlineItemCompareType { ByPosition, @@ -123,6 +122,9 @@ export interface OutlineTemplate { export class OutlineRenderer implements IRenderer { + renderProblemColors = true; + renderProblemBadges = true; + constructor( @IThemeService readonly _themeService: IThemeService, @IConfigurationService readonly _configurationService: IConfigurationService @@ -183,14 +185,14 @@ export class OutlineRenderer implements IRenderer { const color = this._themeService.getTheme().getColor(topSev === MarkerSeverity.Error ? listErrorForeground : listWarningForeground).toString(); // color of the label - if (this._configurationService.getValue(OutlineConfigKeys.problemsColors)) { + if (this.renderProblemColors) { template.labelContainer.style.setProperty('--outline-element-color', color); } else { template.labelContainer.style.removeProperty('--outline-element-color'); } // badge with color/rollup - if (!this._configurationService.getValue(OutlineConfigKeys.problemsBadges)) { + if (!this.renderProblemBadges) { dom.hide(template.decoration); } else if (count > 0) {