diff --git a/src/elements.ts b/src/elements.ts index c951a5c..dd18d52 100644 --- a/src/elements.ts +++ b/src/elements.ts @@ -570,20 +570,18 @@ export class Element extends vscode.TreeItem { command: 'showElementInfo', arguments: [this], }; - - if (viewMode === ViewMode.standard) { - this.label = this.elementData.groupedName; - } - - if (viewMode === ViewMode.palette) { - this.label = this.elementData.titleName; - } this.dataProvider = dataProvider; this.update(); } private update(): void { + if (this.dataProvider.viewMode === ViewMode.standard) { + this.label = this.elementData.groupedName; + } + if (this.dataProvider.viewMode === ViewMode.palette) { + this.label = this.elementData.titleName; + } this.colorConfig = this.dataProvider.colorConfigs[this.elementData.fullName]; const effectiveColor = getEffectiveColor(this.colorConfig); if (effectiveColor) { diff --git a/src/extension.ts b/src/extension.ts index 4487fa1..62f32b9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -8,7 +8,6 @@ import { ElementProvider, ViewMode } from './elements'; import { InfoProvider } from './info'; import { TargetingModeStatusBarItem } from './statusbar'; -let elementProvider: ElementProvider; let infoProvider: InfoProvider; const config = getConfig(); @@ -26,7 +25,7 @@ export function activate(context: vscode.ExtensionContext) { vscode.window.registerTreeDataProvider('codeui.views.info', infoProvider); registerCommand('showElementInfo', (element) => infoProvider.updateSelectedElement(element)); - elementProvider = new ElementProvider(ViewMode.standard); + let elementProvider: ElementProvider = new ElementProvider(ViewMode.standard); vscode.window.registerTreeDataProvider('codeui.views.elements', elementProvider); registerCommand('customize', (element) => elementProvider.customize(element)); registerCommand('adjustBrightness', (element) => elementProvider.adjustBrightness(element));