Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating over settings for Code Actions on Save to Enums #194345

Merged
merged 4 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/vs/editor/browser/config/migrateOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,18 @@ registerEditorSettingMigration('experimental.stickyScroll.maxLineCount', (value,
}
}
});

// Code Actions on Save
registerEditorSettingMigration('codeActionsOnSave', (value, read, write) => {
if (value && typeof value === 'object') {
const newValue = {} as any;
for (const entry of Object.entries(value)) {
if (typeof entry[1] === 'boolean') {
newValue[entry[0]] = entry[1] ? 'explicit' : 'never';
} else {
newValue[entry[0]] = entry[1];
}
}
write(`codeActionsOnSave`, newValue);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ const codeActionsOnSaveSchema: IConfigurationPropertySchema = {
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" `'),
type: 'object',
additionalProperties: {
type: 'string'
type: 'string',
enum: ['always', 'never', 'explicit'],
},
default: {},
default: { 'source.fixAll': 'never', 'source.organizeImports': 'never', },
scope: ConfigurationScope.LANGUAGE_OVERRIDABLE,
};

Expand Down