vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Provide better completion for editor.codeActionsOnSave

Open heejaechang opened this issue 3 years ago • 2 comments

Currently, when user configure editor.codeActionsOnSave, this is what user sees. image

It basically promotes users to write "source.fixAll": true if user wants any fix all to run on save.

problem is it assumes there is only 1 kind of source.fixAll from an extension. but like refactor has refactor.extract, refactor.inline and etc, one extension can provide multiple kinds of fix all code actions.

for example, pylance provides 2 fix all (and plan to add more)

  • source.fixAll.unusedImports
  • source.fixAll.convertImportFormat

but in current user experience, source.fixAll: true basically catch all option. any new fix all added will automatically picked up and run.

so, user basically need to check documentation every time when new version is released for extensions and check new fix all added and disable them if they don't want them.

It would be better if it works the other way around and "editor.codeActionsOnSave" actually show all fix all codeActions in completion so that user can enable each specific fix all they want rather than enable all and disable each specific one.

by the way, I see other extension such as eslint, tslint, stylelint, markdownlint's vscode extension expose only 1 fix all code action and use its own option to control what fix are run on fix all and apply them themselves.

if that is how it is supposed to work, it would be nice to document that in vscode doc and enforce to have only 1 fix all code action.

but even so, showing each fix all kind from each extension should still benefit users in case they want to disable fix all provider of an extension.

heejaechang avatar Sep 19 '22 23:09 heejaechang

related item - https://github.com/microsoft/vscode/issues/82718

heejaechang avatar Sep 19 '22 23:09 heejaechang

and this is how VS works

codecleanup

heejaechang avatar Sep 19 '22 23:09 heejaechang