Skip to content

Commit a6d1949

Browse files
author
Jackson Kearl
authored
Improve UX for deprecated settings (microsoft#55977)
* New settings editor shows depracted settings (only) when modified * Add localized depracation text to augment the existing (nonlocalized) message * Make deprecation warning less wordy, given they are already localized
1 parent 367e841 commit a6d1949

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/vs/workbench/parts/preferences/browser/settingsTree.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ export class SettingsTreeModel {
145145
if (tocEntry.children) {
146146
element.children = tocEntry.children.map(child => this.createSettingsTreeGroupElement(child, element));
147147
} else if (tocEntry.settings) {
148-
element.children = tocEntry.settings.map(s => this.createSettingsTreeSettingElement(<ISetting>s, element));
148+
element.children = tocEntry.settings.map(s => this.createSettingsTreeSettingElement(<ISetting>s, element))
149+
.filter(el => el.setting.deprecationMessage ? el.isConfigured : true);
149150
}
150151

151152
this._treeElementsById.set(element.id, element);
@@ -1413,7 +1414,8 @@ export class SearchResultModel {
14131414

14141415
updateChildren(): void {
14151416
this.children = this.getFlatSettings()
1416-
.map(s => createSettingsTreeSettingElement(s, this, this._viewState.settingsTarget, this._configurationService));
1417+
.map(s => createSettingsTreeSettingElement(s, this, this._viewState.settingsTarget, this._configurationService))
1418+
.filter(el => el.setting.deprecationMessage ? el.isConfigured : true);
14171419

14181420
if (this.newExtensionSearchResults) {
14191421
const newExtElement = new SettingsTreeNewExtensionsElement();

src/vs/workbench/services/preferences/common/preferences.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export interface ISetting {
4444
descriptionRanges: IRange[];
4545
overrides?: ISetting[];
4646
overrideOf?: ISetting;
47+
deprecationMessage?: string;
4748

4849
// TODO@roblou maybe need new type and new EditorModel for GUI editor instead of ISetting which is used for text settings editor
4950
type?: string | string[];

src/vs/workbench/services/preferences/common/preferencesModels.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,15 @@ export class DefaultSettings extends Disposable {
551551
let result: ISetting[] = [];
552552
for (let key in settingsObject) {
553553
const prop = settingsObject[key];
554-
if (!prop.deprecationMessage && this.matchesScope(prop)) {
554+
if (this.matchesScope(prop)) {
555555
const value = prop.default;
556556
const description = (prop.description || '').split('\n');
557+
if (prop.deprecationMessage) {
558+
description.push(
559+
'',
560+
prop.deprecationMessage,
561+
nls.localize('deprecatedSetting.unstable', "This setting should not be used, and will be removed in a future release."));
562+
}
557563
const overrides = OVERRIDE_PROPERTY_PATTERN.test(key) ? this.parseOverrideSettings(prop.default) : [];
558564
result.push({
559565
key,
@@ -567,7 +573,8 @@ export class DefaultSettings extends Disposable {
567573
type: prop.type,
568574
enum: prop.enum,
569575
enumDescriptions: prop.enumDescriptions,
570-
tags: prop.tags
576+
tags: prop.tags,
577+
deprecationMessage: prop.deprecationMessage,
571578
});
572579
}
573580
}

0 commit comments

Comments
 (0)