From 907cc3e3d81524d667e9acae3ab20cc36cc74f46 Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Tue, 7 Jun 2022 18:01:04 -0700 Subject: [PATCH] Simplify default override indicator impl (#151461) Fixes #151164 --- .../browser/settingsEditorSettingIndicators.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts index 7f5d1e698ed..aac1b348f1c 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts @@ -125,13 +125,15 @@ export class SettingsTreeIndicatorsLabel { const defaultValueSource = element.defaultValueSource; if (defaultValueSource) { this.defaultOverrideIndicatorElement.style.display = 'inline'; + let sourceToDisplay = ''; if (typeof defaultValueSource !== 'string' && defaultValueSource.id !== element.setting.extensionInfo?.id) { - const extensionSource = defaultValueSource.displayName ?? defaultValueSource.id; - this.defaultOverrideIndicatorLabel.title = localize('defaultOverriddenDetails', "Default setting value overridden by {0}", extensionSource); - this.defaultOverrideIndicatorLabel.text = localize('defaultOverrideLabelText', "$(replace) {0}", extensionSource); + sourceToDisplay = defaultValueSource.displayName ?? defaultValueSource.id; } else if (typeof defaultValueSource === 'string') { - this.defaultOverrideIndicatorLabel.title = localize('defaultOverriddenDetails', "Default setting value overridden by {0}", defaultValueSource); - this.defaultOverrideIndicatorLabel.text = localize('defaultOverrideLabelText', "$(replace) {0}", defaultValueSource); + sourceToDisplay = defaultValueSource; + } + if (sourceToDisplay) { + this.defaultOverrideIndicatorLabel.title = localize('defaultOverriddenDetails', "Default setting value overridden by {0}", sourceToDisplay); + this.defaultOverrideIndicatorLabel.text = `$(replace) ${sourceToDisplay}`; } } this.render();