From a6d1949dca839af0f7e1e8cc323c6d9db5982f43 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 8 Aug 2018 10:32:11 -0700 Subject: [PATCH] Improve UX for deprecated settings (#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 --- .../parts/preferences/browser/settingsTree.ts | 6 ++++-- .../services/preferences/common/preferences.ts | 1 + .../services/preferences/common/preferencesModels.ts | 11 +++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/settingsTree.ts b/src/vs/workbench/parts/preferences/browser/settingsTree.ts index 0afa7baa54c..eaa91fd368b 100644 --- a/src/vs/workbench/parts/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/parts/preferences/browser/settingsTree.ts @@ -145,7 +145,8 @@ export class SettingsTreeModel { if (tocEntry.children) { element.children = tocEntry.children.map(child => this.createSettingsTreeGroupElement(child, element)); } else if (tocEntry.settings) { - element.children = tocEntry.settings.map(s => this.createSettingsTreeSettingElement(s, element)); + element.children = tocEntry.settings.map(s => this.createSettingsTreeSettingElement(s, element)) + .filter(el => el.setting.deprecationMessage ? el.isConfigured : true); } this._treeElementsById.set(element.id, element); @@ -1413,7 +1414,8 @@ export class SearchResultModel { updateChildren(): void { this.children = this.getFlatSettings() - .map(s => createSettingsTreeSettingElement(s, this, this._viewState.settingsTarget, this._configurationService)); + .map(s => createSettingsTreeSettingElement(s, this, this._viewState.settingsTarget, this._configurationService)) + .filter(el => el.setting.deprecationMessage ? el.isConfigured : true); if (this.newExtensionSearchResults) { const newExtElement = new SettingsTreeNewExtensionsElement(); diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index 45f0caf3b35..9718d8eaf1b 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -44,6 +44,7 @@ export interface ISetting { descriptionRanges: IRange[]; overrides?: ISetting[]; overrideOf?: ISetting; + deprecationMessage?: string; // TODO@roblou maybe need new type and new EditorModel for GUI editor instead of ISetting which is used for text settings editor type?: string | string[]; diff --git a/src/vs/workbench/services/preferences/common/preferencesModels.ts b/src/vs/workbench/services/preferences/common/preferencesModels.ts index 1898d088670..ac27d3ccf50 100644 --- a/src/vs/workbench/services/preferences/common/preferencesModels.ts +++ b/src/vs/workbench/services/preferences/common/preferencesModels.ts @@ -551,9 +551,15 @@ export class DefaultSettings extends Disposable { let result: ISetting[] = []; for (let key in settingsObject) { const prop = settingsObject[key]; - if (!prop.deprecationMessage && this.matchesScope(prop)) { + if (this.matchesScope(prop)) { const value = prop.default; const description = (prop.description || '').split('\n'); + if (prop.deprecationMessage) { + description.push( + '', + prop.deprecationMessage, + nls.localize('deprecatedSetting.unstable', "This setting should not be used, and will be removed in a future release.")); + } const overrides = OVERRIDE_PROPERTY_PATTERN.test(key) ? this.parseOverrideSettings(prop.default) : []; result.push({ key, @@ -567,7 +573,8 @@ export class DefaultSettings extends Disposable { type: prop.type, enum: prop.enum, enumDescriptions: prop.enumDescriptions, - tags: prop.tags + tags: prop.tags, + deprecationMessage: prop.deprecationMessage, }); } } -- GitLab