Open WORMSS opened 3 years ago
^Second that, and thx @WORMSS for sharing the config.
Maybe we can have a config for this extension to control the sort on save behavior?
Just ran into this issue the other day, in a project that has editor.formatOnSave: true
in its project-level configuration. VSCode's default for this setting is false
.
I understand there's a tradeoff when adding new functionality to an extension:
(where X is a placeholder for any new feature that does an automatic thing)
Since formatting on save is an intrusive operation, in the sense that it changes your code, I feel it would have been better to stick with opt-in, and play it safe. That is, if a user happened to have editor.formatOnSave: true
set. In other words, source.fixAll.sortJSON: false
should've been the default, the way I see it.
It seems that "source.fixAll.sortJSON": false
no longer works. After some VSC updates, my package.json
files keep getting sorted. I even tried setting:
"sortJSON.excludedFiles": [
"package.json"
],
Update: You should now use the following syntax rather than a boolean:
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.fixAll.sortJSON": "never"
},
It was more difficult that it needed to be to disable sorting on save.
I ended up having to manually write in the settings file
Was very annoying.. I am not sure when sort on save became a thing, but I had been blaming vscode for messing up my files for ages until my co-workers who also use vscode were reporting no such problems.