← 返回列表
全部 Skill›商业 Business›setting-names

setting-names

作者 @microsoft · 语言 en
Use when adding, renaming, or reviewing a VS Code setting ID, or when marking a setting as experimental, preview, or advanced. Covers why maturity goes in `tags` rather than in the setting ID, and how to rename a setting with a migration.
商业 Business销售与营销通用待翻译
最近源活动
—
检测 SKILL.md 语言
en
星标 ★
195,664
分支 Fork
0
安装选项
提示
指令
使用 AI 助手安装
将下面的提示复制到你正在使用的 AI 助手中。
下载完整 Skill 目录(含全部配套文件)。 下载压缩包 ↓
SKILL.md 原文预览

Setting names

A setting ID is permanent: users write it into settings.json, settings sync, dotfiles, docs, and policies. Name it for what it controls, never for how mature it is.

Maturity goes in tags, not in the ID

Don't put experimental, preview, beta, or similar into a setting ID (foo.experimental.bar, foo.experimentalBar). Use tags instead:

'chat.foo.enabled': {
	type: 'boolean',
	default: false,
	tags: ['experimental'],
	description: localize('chat.foo.enabled', "Controls whether foo is enabled."),
},
  • experimental: the feature might change a lot or be removed.
  • preview: we intend to keep the feature, but it is not finished yet. Since it will stay, the ID must already be the final one.
  • advanced: hidden from the Settings editor unless the user filters by @tag:advanced or searches for the setting ID. This is independent of maturity.

The Settings editor shows an "Experimental" or "Preview" badge for these tags, sorts them after stable settings, and lets users filter them with @tag:experimental, @tag:preview, and @tag:stable. When the feature graduates, remove the tag (and maybe change the default); the ID stays the same and nobody's settings break.

An experimental tag doesn't put a setting under A/B experiment control. That needs experiment: { mode } (see the experiments skill). The treatment name defaults to config.<setting ID>, so when you rename an experiment-controlled setting, keep the old treatment with experiment: { mode, name: 'config.<old ID>' }; ExP needs updating only if the resolved treatment name changes.

The only exception is a setting that will be deleted rather than promoted, for example a temporary toggle for an alternative implementation. A name that says so is acceptable there, but the tag is still preferred.

Renaming a setting

Avoid renames. If one is unavoidable (for example to drop an existing experimental segment), register a migration in IConfigurationMigrationRegistry (configuration.ts) that moves existing values to the new ID without overwriting a value the user already set there:

Registry.as<IConfigurationMigrationRegistry>(WorkbenchExtensions.ConfigurationMigration)
	.registerConfigurationMigrations([{
		key: 'foo.experimental.bar',
		migrateFn: (value: unknown, valueAccessor) => {
			const result: ConfigurationKeyValuePairs = [['foo.experimental.bar', { value: undefined }]];
			if (value !== undefined && valueAccessor('foo.bar') === undefined) {
				result.push(['foo.bar', { value }]);
			}
			return result;
		}
	}]);

Also update docs, tests, and other code that reads the old ID.

评论
Mmicrosoft
microsoft
microsoft/vscode
查看 GitHub 仓库 查看作者的其他 Skill
来源信息
作者@microsoft
所属大类商业 Business / 销售与营销
国内可用性通用
最近源活动—
风险提示无
提示:风险标签为程序静态扫描结果,仅作提示,不代表安全认证。安装前请阅读 SKILL.md 及其引用的脚本、权限,自行判断是否可信。