Skip to content

Customise the order of codeActionsOnSave inc. formatOnSave #105301

Description

I've become used to using the default vscode.typescript-language-features as my JS formatter. However, the organisation I work for use eslint as a formatter. Ideally I'd like to not override my global formatter.

The dbaeumer.vscode-eslint extension offers a fantastic solution, on paper:

"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
}

This will effectively resolve any formatting conflicts with the built-in formatter by fixing the linting errors when I save in projects that use eslint. Problem is, I also like to use editor.formatOnSave. I believe this actually runs after editor.codeActionsOnSave which results in eslint's tweaks being instantly reverted. The order editor.codeActionsOnSave executes can indeed be customised by setting it as an array instead of as an object, however editor.formatOnSave is its own bespoke setting, and seems to always execute after editor.codeActionsOnSave.

To summarise, I want to be able to set editor.codeActionsOnSave to execute before editor.formatOnSave. Potential solutions could be:

  • A setting like editor.formatOnSaveAfterCodeActionsOnSave, true by default
  • The ability to add editor.formatOnSave to the codeActionsOnSave array

Thanks :)

Metadata

Metadata

Labels

editor-code-actionsEditor inplace actions (Ctrl + .)feature-requestRequest for new features or functionalityformattingSource formatter issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions