Simplify default override indicator impl (#151461)

Fixes #151164
pull/151475/head
Raymond Zhao 2022-06-07 18:01:04 -07:00 committed by GitHub
parent 60a68d666d
commit 907cc3e3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -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();