-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
breaking: codeActionsOnSave #194861
Comments
Source seems to indicate that array is still allowed: vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.ts Lines 40 to 62 in 7d4027b
|
Or maybe when 153335b from @justschen added |
This is possible. If I try with an array this is the result: And no actions are performed (with the array filled with the proper actions) |
* removed saveReason check for autosave * modified setting values and enabling on autosave or not * cleanup * add default to false settings * modified code action save settings * changed default setting * cleanup code and added backward compatibility * aded minor comment and checking commit signing * second check on commit signing (sorry) * fix typo * small bugfix and adding proper backward compatibility * deprecate boolean values by converting them
Error might be coming from 153335b in Interesting case - when there are Code Actions in the array, even with the error (saying |
I tried rolling back to my previous conf:
And unfortunately no actions are performed |
roger. looking at it rn, and draft PR is mentioned here. will take a look at this again first thing in the morning. |
Probably same issue on SO: editor.codeActionsOnSave does not run in order: changes form VSCode 1.82 to VSCode 1.83 |
@ArturoDent not sure if you are the OP, but I wasn't able to find a difference in current behavior vs. what happens in 1.82. @ilteoood Do you have a repro of this for expected vs. current behavior? Assessing if there is a work around using the object configuration we have in 1.83 or not. edit: still wasn't able to get a repro, but the main issue atm is that objects don't allow specific orderings.
|
@justschen Thanks for taking this on! The difference in current behavior vs 1.82 is that in 1.83 array values are silently ignored, and code actions are not run on save As you have mentioned, an object config is not suitable because we can't specify the order. This broke our dev environment, and we look forward to a fix. Thank you! |
Running into this issue as well, so it is very much appreciated @justschen that you are looking into this. Specifically, we are using a combination of Prettier and ESLint for formatting and linting to enforce JS Standard Style, which depends on the order in which the actions are applied. "editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"],
"editor.defaultFormatter": "esbenp.prettier-vscode", Being able to format the document via Prettier and then applying ESLint fixes does not seem to be possible with the object notation right now. With v1.83.0, when the array is used for |
Hi @justschen, here is a repro. Consider this spec file: https://github.com/orchy-mfe/orchy-core/blob/main/packages/web-component/src/configuration-client/httpConfigurationClient.spec.ts Here is the behaviour of vscode 1.82: While this is the behaviour of vscode 1.83, without any change in the configuration: If I update the configuration to be an object, this is the final result: As you can see, at each save imports are flickering but never really fixed. |
Candidate PR will just add back support for arrays for now! Under discussion atm if orderings from objects will be considered. |
insiders PR: #194870 Things to test:
Example for arrays: "editor.codeActionsOnSave": [
"editor.formatOnSave",
"source.organizeImports",
"source.sortImports",
"source.fixAll"
] Runs when code actions are in the array, does not run when code actions are excluded from the array. Known issues:
|
Arrays for codeactionsonsave were what allowed the "Format Code Action", rohit-gohri.format-code-action to work. This was important because the array determines the order which you can't do with an object. This was broken with 1.83 change to object. |
verified on latest insiders Version: 1.84.0-insider (user setup) |
Does this issue occur when all extensions are disabled?: Yes/No
Steps to Reproduce:
With version 1.83.0, codeActionsOnSave accepts only an object. Unfortunately for my use case is deal-breaker because I would like to apply format and sorting before the lint. With the object configuration, it is not possible anymore.
This is my actual configuration:
There is an old issue that describes my exact same case: #88131.
Do you have any workaround to achieve the same result, or can you please consider rolling back the array configuration?
The text was updated successfully, but these errors were encountered: