Change:
The setting currently accepts an object: The of the actions prioritizes actions and executes them first. This may be a good idea for certain (or even most) setups, but it's not for all of them. In my example, i'm using both and . Because there are strict auto formatting rules set up in eslint regarding line length, line breaks etc, i would want to organizeImports first before then fixing and reformatting everything with ESLint. This is impossible to do right now because the is always executed first, which results in this behavior: ! This is unfortunate and means that we had to disable the functionality altogether. I'm pretty sure we're not the first ones having this problem and i'm really asking myself why the configuration of is not an array instead, giving us the explicit possibility to order the sequential execution of code actions: What are your suggestions? Is anyone else having this problem?
//fyi
<!-- -96bd-47a8-a0e8- --This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our . Happy Coding!
How do upvotes work? Thumbs up on the original issue post?
Yes :)
I had to disable the functionality too.
<!-- -c9e0-7adb-d31b- --:slightlysmilingface: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our . Happy Coding!
! Seeing strange behaviour with this. For one it alternates between applying eslint and organizeImports with each save, but it also now pops up a browser window pointing to the Options section of the eslint-plugin-prettier readme on github too? Browser window doesn't appear when codeactions is an object. Repro repo with steps in README: In eslint output channel when going from the orginizeImports save version to the eslint save version: This is also when the browser window appears
It seems the issue with the browser window popping up is independent of the action. If I set eslint to be the only code action to run via an object, it works fine. If I set it to be the only code action to run via array, it gives the error. It might be that when set via array it's not able to read the config properly, so the extension is trying to be helpful and open the browser for me?
Thanks for the example I believe this is an eslint issue. Here's an annotated trace when the trailing comma is present: VS Code update the document using organize imports (removing the trailing comma) VS Code request code actions for fix all ESlint updates it's diagnostics ESLint then returns no code actions So it looks like ESLint gets the events in the right order, but is computing code actions on the previous document's state I've opened against eslint for this
I verified the events are fired in the correct order with new setting config

Discussion:
}); const codeActionsOnSaveSchema: IConfigurationPropertySchema = { <del> type: 'object', properties: codeActionsOnSaveDefaultProperties, 'additionalProperties': { type: 'boolean' }, </del> <ins> oneOf: [ { type: 'object', properties: codeActionsOnSaveDefaultProperties, additionalProperties: { type: 'boolean' }, }, { type: 'array', items: { type: 'string' } } ], </ins> default: {}, description: nls.localize('codeActionsOnSave', "Code action kinds to be run on save."), scope: ConfigurationScope.LANGUAGE_OVERRIDABLE,

const model = editorModel.textEditorModel; const settingsOverrides = { overrideIdentifier: model.getLanguageIdentifier().language, resource: editorModel.resource }; <del> const setting = this.configurationService.getValue<{ [kind: string]: boolean }>('editor.codeActionsOnSave', settingsOverrides); </del> <ins> const setting = this.configurationService.getValue<{ [kind: string]: boolean } | string[]>('editor.codeActionsOnSave', settingsOverrides); </ins> if (!setting) { return undefined; } <del> const codeActionsOnSave = Object.keys(setting) .filter(x => setting[x]).map(x => new CodeActionKind(x)) .sort((a, b) => { </del> <ins> const settingItems: string[] = Array.isArray(setting) ? setting : Object.keys(setting).filter(x => setting[x]); const codeActionsOnSave = settingItems .map(x => new CodeActionKind(x)); if (!Array.isArray(setting)) { codeActionsOnSave.sort((a, b) => { </ins> if (CodeActionKind.SourceFixAll.contains(a)) { if (CodeActionKind.SourceFixAll.contains(b)) { return 0;

} return 0; }); <ins> } </ins> if (!codeActionsOnSave.length) { return undefined; } <del> const excludedActions = Object.keys(setting) .filter(x => setting[x] === false) .map(x => new CodeActionKind(x)); </del> <ins> const excludedActions = Array.isArray(setting) ? [] : Object.keys(setting) .filter(x => setting[x] === false) .map(x => new CodeActionKind(x)); </ins> progress.report({ message: localize('codeaction', "Quick Fixes") }); await this.applyOnSaveActions(model, codeActionsOnSave, excludedActions, progress, token);