Skip to content

Commit 411d298

Browse files
authored
Removed default settings for Code Actions on Save (microsoft#194409)
* removed default settings * removed whitespace * changed wordage * boolean and string enum together * updated language around settings, mentioning things will be deprecated * changed settings accross noteboks as well * Update codeActionModel.ts
1 parent 4ceb99a commit 411d298

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,21 @@ registerEditorSettingMigration('experimental.stickyScroll.maxLineCount', (value,
193193
}
194194
});
195195

196-
// // Code Actions on Save
196+
// Code Actions on Save
197197
// registerEditorSettingMigration('codeActionsOnSave', (value, read, write) => {
198198
// if (value && typeof value === 'object') {
199+
// let toBeModified = false;
199200
// const newValue = {} as any;
200201
// for (const entry of Object.entries(value)) {
201202
// if (typeof entry[1] === 'boolean') {
203+
// toBeModified = true;
202204
// newValue[entry[0]] = entry[1] ? 'explicit' : 'never';
203205
// } else {
204206
// newValue[entry[0]] = entry[1];
205207
// }
206208
// }
207-
// write(`codeActionsOnSave`, newValue);
209+
// if (toBeModified) {
210+
// write(`codeActionsOnSave`, newValue);
211+
// }
208212
// }
209213
// });

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ import { IExtensionPoint } from 'vs/workbench/services/extensions/common/extensi
1919

2020
const createCodeActionsAutoSave = (description: string): IJSONSchema => {
2121
return {
22-
type: 'string',
23-
enum: ['always', 'never', 'explicit'],
24-
enumDescriptions: [nls.localize('alwaysSave', 'Always triggers Code Actions on save'), nls.localize('neverSave', 'Never triggers Code Actions on save'), nls.localize('explicitSave', 'Triggers Code Actions only when explicitly saved')],
25-
default: 'explicit',
22+
type: ['string', 'boolean'],
23+
enum: ['always', 'explicit', 'never', true, false],
24+
enumDescriptions: [
25+
nls.localize('alwaysSave', 'Triggers Code Actions on explicit saves and auto saves triggered by window or focus changes.'),
26+
nls.localize('explicitSave', 'Triggers Code Actions only when explicitly saved'),
27+
nls.localize('neverSave', 'Never triggers Code Actions on save'),
28+
nls.localize('explicitSaveBoolean', 'Triggers Code Actions only when explicitly saved. This value will be deprecated in favor of "explicit".'),
29+
nls.localize('neverSaveBoolean', 'Never triggers Code Actions on save. This value will be deprecated in favor of "never".')
30+
],
31+
default: true,
2632
description: description
2733
};
2834
};
@@ -37,7 +43,7 @@ const codeActionsOnSaveSchema: IConfigurationPropertySchema = {
3743
type: 'object',
3844
properties: codeActionsOnSaveDefaultProperties,
3945
additionalProperties: {
40-
type: 'string'
46+
type: ['string', 'boolean']
4147
},
4248
},
4349
{
@@ -48,10 +54,10 @@ const codeActionsOnSaveSchema: IConfigurationPropertySchema = {
4854
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" `'),
4955
type: 'object',
5056
additionalProperties: {
51-
type: 'string',
52-
enum: ['always', 'never', 'explicit'],
57+
type: ['string', 'boolean'],
58+
enum: ['always', 'explicit', 'never', true, false],
5359
},
54-
default: { 'source.fixAll': 'never', 'source.organizeImports': 'never', },
60+
default: {},
5561
scope: ConfigurationScope.LANGUAGE_OVERRIDABLE,
5662
};
5763

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,14 +964,14 @@ configurationRegistry.registerConfiguration({
964964
default: false
965965
},
966966
[NotebookSetting.codeActionsOnSave]: {
967-
markdownDescription: nls.localize('notebook.codeActionsOnSave', "Run a series of CodeActions for a notebook on save. CodeActions must be specified, the file must not be saved after delay, and the editor must not be shutting down. Example: `source.fixAll: true`"),
967+
markdownDescription: nls.localize('notebook.codeActionsOnSave', 'Run a series of CodeActions for a notebook on save. CodeActions must be specified, the file must not be saved after delay, and the editor must not be shutting down. Example: `"source.fixAll": "explicit"`'),
968968
type: 'object',
969969
additionalProperties: {
970-
type: 'string',
971-
enum: ['explicit', 'never'],
970+
type: ['string', 'boolean'],
971+
enum: ['explicit', 'never', true, false],
972972
// enum: ['explicit', 'always', 'never'], -- autosave support needs to be built first
973973
// nls.localize('always', 'Always triggers Code Actions on save, including autosave, focus, and window change events.'),
974-
enumDescriptions: [nls.localize('explicit', 'Triggers Code Actions only when explicitly saved.', nls.localize('never', 'Never triggers Code Actions on save.'))],
974+
enumDescriptions: [nls.localize('explicit', 'Triggers Code Actions only when explicitly saved.'), nls.localize('never', 'Never triggers Code Actions on save.'), nls.localize('explicitBoolean', 'Triggers Code Actions only when explicitly saved. This value will be deprecated in favor of "explicit".'), nls.localize('neverBoolean', 'Triggers Code Actions only when explicitly saved. This value will be deprecated in favor of "never".')],
975975
},
976976
default: {}
977977
},

0 commit comments

Comments
 (0)