未验证 提交 a6d1949d 编写于 作者: J Jackson Kearl 提交者: GitHub

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
上级 367e841d
......@@ -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(<ISetting>s, element));
element.children = tocEntry.settings.map(s => this.createSettingsTreeSettingElement(<ISetting>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();
......
......@@ -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[];
......
......@@ -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,
});
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册