Skip to content

Commit ce818fc

Browse files
authored
add error if tag contains onexp and experiment property is not set (microsoft#257112)
* add error if tag contains `onexp` and experiment property is not set * rename
1 parent 61ac05d commit ce818fc

File tree

10 files changed

+32
-25
lines changed

10 files changed

+32
-25
lines changed

src/vs/editor/common/config/editorConfigurationSchema.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const editorConfiguration: IConfigurationNode = {
117117
markdownDescription: nls.localize('editor.experimental.treeSitterTelemetry', "Controls whether tree sitter parsing should be turned on and telemetry collected. Setting `editor.experimental.preferTreeSitter` for specific languages will take precedence."),
118118
tags: ['experimental'],
119119
experiment: {
120-
allowAutoUpdate: false
120+
mode: 'startup'
121121
}
122122
},
123123
'editor.experimental.preferTreeSitter.css': {
@@ -126,7 +126,7 @@ const editorConfiguration: IConfigurationNode = {
126126
markdownDescription: nls.localize('editor.experimental.preferTreeSitter.css', "Controls whether tree sitter parsing should be turned on for css. This will take precedence over `editor.experimental.treeSitterTelemetry` for css."),
127127
tags: ['experimental'],
128128
experiment: {
129-
allowAutoUpdate: false
129+
mode: 'startup'
130130
}
131131
},
132132
'editor.experimental.preferTreeSitter.typescript': {
@@ -135,7 +135,7 @@ const editorConfiguration: IConfigurationNode = {
135135
markdownDescription: nls.localize('editor.experimental.preferTreeSitter.typescript', "Controls whether tree sitter parsing should be turned on for typescript. This will take precedence over `editor.experimental.treeSitterTelemetry` for typescript."),
136136
tags: ['experimental'],
137137
experiment: {
138-
allowAutoUpdate: false
138+
mode: 'startup'
139139
}
140140
},
141141
'editor.experimental.preferTreeSitter.ini': {
@@ -144,7 +144,7 @@ const editorConfiguration: IConfigurationNode = {
144144
markdownDescription: nls.localize('editor.experimental.preferTreeSitter.ini', "Controls whether tree sitter parsing should be turned on for ini. This will take precedence over `editor.experimental.treeSitterTelemetry` for ini."),
145145
tags: ['experimental'],
146146
experiment: {
147-
allowAutoUpdate: false
147+
mode: 'startup'
148148
}
149149
},
150150
'editor.experimental.preferTreeSitter.regex': {
@@ -153,7 +153,7 @@ const editorConfiguration: IConfigurationNode = {
153153
markdownDescription: nls.localize('editor.experimental.preferTreeSitter.regex', "Controls whether tree sitter parsing should be turned on for regex. This will take precedence over `editor.experimental.treeSitterTelemetry` for regex."),
154154
tags: ['experimental'],
155155
experiment: {
156-
allowAutoUpdate: false
156+
mode: 'startup'
157157
}
158158
},
159159
'editor.language.brackets': {

src/vs/editor/common/config/editorOptions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4471,7 +4471,7 @@ class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, I
44714471
tags: ['experimental'],
44724472
description: nls.localize('inlineSuggest.suppressInlineSuggestions', "Suppresses inline completions for specified extension IDs -- comma separated."),
44734473
experiment: {
4474-
allowAutoUpdate: false
4474+
mode: 'startup'
44754475
}
44764476
},
44774477
'editor.inlineSuggest.experimental.triggerCommandOnProviderChange': {
@@ -4480,7 +4480,7 @@ class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, I
44804480
tags: ['experimental'],
44814481
description: nls.localize('inlineSuggest.triggerCommandOnProviderChange', "Controls whether to trigger a command when the inline suggestion provider changes."),
44824482
experiment: {
4483-
allowAutoUpdate: false
4483+
mode: 'startup'
44844484
}
44854485
},
44864486
'editor.inlineSuggest.fontFamily': {
@@ -6335,7 +6335,7 @@ export const EditorOptions = {
63356335
{
63366336
description: nls.localize('quickSuggestionsDelay', "Controls the delay in milliseconds after which quick suggestions will show up."),
63376337
experiment: {
6338-
allowAutoUpdate: false
6338+
mode: 'startup'
63396339
}
63406340
}
63416341
)),

src/vs/platform/configuration/common/configurationRegistry.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@ export interface IConfigurationPropertySchema extends IJSONSchema {
223223
*/
224224
experiment?: {
225225
/**
226-
* Whether to automatically update the setting default value when the experiment value changes.
226+
* The mode of the experiment.
227+
* - `startup`: The setting value is updated to the experiment value only on startup.
228+
* - `auto`: The setting value is updated to the experiment value automatically (whenever the experiment value changes).
227229
*/
228-
allowAutoUpdate: boolean;
230+
mode: 'startup' | 'auto';
229231

230232
/**
231233
* The name of the experiment. By default, this is `config.${settingId}`
@@ -673,8 +675,13 @@ class ConfigurationRegistry extends Disposable implements IConfigurationRegistry
673675
}
674676

675677
if (property.experiment) {
676-
property.tags = property.tags ?? [];
677-
property.tags.push('onExP');
678+
if (!property.tags?.some(tag => tag.toLowerCase() === 'onexp')) {
679+
property.tags = property.tags ?? [];
680+
property.tags.push('onExP');
681+
}
682+
} else if (property.tags?.some(tag => tag.toLowerCase() === 'onexp')) {
683+
console.error(`Invalid tag 'onExP' found for property '${key}'. Please use 'experiment' property instead.`);
684+
property.experiment = { mode: 'startup' };
678685
}
679686

680687
const excluded = properties[key].hasOwnProperty('included') && !properties[key].included;

src/vs/workbench/api/common/configurationExtensionPoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ configurationExtPoint.setHandler((extensions, { added, removed }) => {
273273
}
274274
if (propertyConfiguration.tags?.some(tag => tag.toLowerCase() === 'onexp')) {
275275
propertyConfiguration.experiment = {
276-
allowAutoUpdate: false
276+
mode: 'startup'
277277
};
278278
}
279279
seenProperties.add(key);

src/vs/workbench/browser/workbench.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
539539
'enum': ['hidden', 'visibleInWorkspace', 'visible', 'maximizedInWorkspace', 'maximized'],
540540
'default': 'hidden',
541541
'experiment': {
542-
allowAutoUpdate: false
542+
mode: 'startup'
543543
},
544544
'description': localize('secondarySideBarDefaultVisibility', "Controls the default visibility of the secondary side bar in workspaces or empty windows opened for the first time."),
545545
'enumDescriptions': [
@@ -630,7 +630,7 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
630630
'description': localize('settings.showAISearchToggle', "Controls whether the AI search results toggle is shown in the search bar in the Settings editor after doing a search and once AI search results are available."),
631631
'tags': ['experimental'],
632632
'experiment': {
633-
allowAutoUpdate: false
633+
mode: 'startup'
634634
}
635635
},
636636
'workbench.hover.delay': {

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ configurationRegistry.registerConfiguration({
263263
default: 'inline',
264264
tags: ['experimental'],
265265
experiment: {
266-
allowAutoUpdate: false
266+
mode: 'startup'
267267
}
268268
},
269269
'chat.emptyChatState.enabled': {
@@ -272,7 +272,7 @@ configurationRegistry.registerConfiguration({
272272
description: nls.localize('chat.emptyChatState', "Shows a modified empty chat state with hints in the input placeholder text."),
273273
tags: ['experimental'],
274274
experiment: {
275-
allowAutoUpdate: false
275+
mode: 'startup'
276276
}
277277
},
278278
'chat.checkpoints.enabled': {
@@ -329,7 +329,7 @@ configurationRegistry.registerConfiguration({
329329
description: nls.localize('chat.edits2Enabled', "Enable the new Edits mode that is based on tool-calling. When this is enabled, models that don't support tool-calling are unavailable for Edits mode."),
330330
default: true,
331331
experiment: {
332-
allowAutoUpdate: false
332+
mode: 'startup'
333333
}
334334
},
335335
[ChatConfiguration.ExtensionToolsEnabled]: {
@@ -347,7 +347,7 @@ configurationRegistry.registerConfiguration({
347347
description: nls.localize('chat.agent.enabled.description', "Enable agent mode for {0}. When this is enabled, agent mode can be activated via the dropdown in the view.", 'Copilot Chat'),
348348
default: true,
349349
experiment: {
350-
allowAutoUpdate: false
350+
mode: 'startup'
351351
},
352352
policy: {
353353
name: 'ChatAgentMode',
@@ -510,7 +510,7 @@ configurationRegistry.registerConfiguration({
510510
default: 'default',
511511
tags: ['experimental'],
512512
experiment: {
513-
allowAutoUpdate: false
513+
mode: 'startup'
514514
}
515515
}
516516
}

src/vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ configurationRegistry.registerConfiguration({
3737
default: false,
3838
tags: ['experimental'],
3939
experiment: {
40-
allowAutoUpdate: false
40+
mode: 'startup'
4141
}
4242
},
4343
[EDIT_TELEMETRY_SHOW_STATUS_BAR]: {

src/vs/workbench/contrib/inlineChat/common/inlineChat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
6565
type: 'boolean',
6666
tags: ['preview'],
6767
experiment: {
68-
allowAutoUpdate: false
68+
mode: 'startup'
6969
}
7070
},
7171
[InlineChatConfigKeys.HideOnRequest]: {
@@ -74,7 +74,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
7474
type: 'boolean',
7575
tags: ['preview'],
7676
experiment: {
77-
allowAutoUpdate: false
77+
mode: 'startup'
7878
}
7979
},
8080
}

src/vs/workbench/contrib/performance/electron-browser/performance.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Registry.as<IConfigurationRegistry>(ConfigExt.Configuration).registerConfigurati
4343
tags: ['experimental'],
4444
markdownDescription: localize('experimental.rendererProfiling', "When enabled, slow renderers are automatically profiled."),
4545
experiment: {
46-
allowAutoUpdate: false
46+
mode: 'startup'
4747
}
4848
}
4949
}

src/vs/workbench/services/configuration/browser/configurationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ class ConfigurationDefaultOverridesContribution extends Disposable implements IW
13931393
continue;
13941394
}
13951395
this.processedExperimentalSettings.add(property);
1396-
if (schema.experiment.allowAutoUpdate) {
1396+
if (schema.experiment.mode === 'auto') {
13971397
this.autoRefetchExperimentalSettings.add(property);
13981398
}
13991399
try {

0 commit comments

Comments
 (0)