mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-26 09:45:54 +01:00
outline - prepare tree classes for move
This commit is contained in:
@@ -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<string, OutlineTreeState>(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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user