Skip to content

Commit 48cd067

Browse files
authored
Migrating over settings for Code Actions on Save to Enums (#194345)
* migrating over from booleans to enums * explicit not always * cleaned up and removed unused comma
1 parent ca4a46a commit 48cd067

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/vs/editor/browser/config/migrateOptions.ts

+15
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,18 @@ registerEditorSettingMigration('experimental.stickyScroll.maxLineCount', (value,
192192
}
193193
}
194194
});
195+
196+
// Code Actions on Save
197+
registerEditorSettingMigration('codeActionsOnSave', (value, read, write) => {
198+
if (value && typeof value === 'object') {
199+
const newValue = {} as any;
200+
for (const entry of Object.entries(value)) {
201+
if (typeof entry[1] === 'boolean') {
202+
newValue[entry[0]] = entry[1] ? 'explicit' : 'never';
203+
} else {
204+
newValue[entry[0]] = entry[1];
205+
}
206+
}
207+
write(`codeActionsOnSave`, newValue);
208+
}
209+
});

src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ const codeActionsOnSaveSchema: IConfigurationPropertySchema = {
4848
markdownDescription: nls.localize('editor.codeActionsOnSave', 'Run CodeActions for the editor on save. CodeActions must be specified and the editor must not be shutting down. Example: `"source.organizeImports": "explicit" `'),
4949
type: 'object',
5050
additionalProperties: {
51-
type: 'string'
51+
type: 'string',
52+
enum: ['always', 'never', 'explicit'],
5253
},
53-
default: {},
54+
default: { 'source.fixAll': 'never', 'source.organizeImports': 'never', },
5455
scope: ConfigurationScope.LANGUAGE_OVERRIDABLE,
5556
};
5657

0 commit comments

Comments
 (0)