Repository navigation
Add editor.codeActionsOnSave - #48086
Conversation
480042b to
0602636
Compare
There was a problem hiding this comment.
Could be an object literal because that enables merging/overwriting
There was a problem hiding this comment.
Done. Yes an object is much nicer to work with
There was a problem hiding this comment.
I like - running them one after the other is the sane thing to do IMO
There was a problem hiding this comment.
Add timeout and make it configurable, like editor.formatOnSaveTimeout
In the format-case we only pick one provider (the last that got registered). That makes applying formatting edits simpler but there is a strong desire to change that, e.g. run them sequentially. If formatting or code actions undo/destroy the work of a pre-running operation that's tough luck. I'd make sure tho to maintain a somewhat stable order, e.g sort them by provider
I'd say off by default
Unsure, extension authors might now start to use source for everything but also fair to start like this. We should document this well, e.g. should source be used for something like 'insert missing semi-colons'? |
0602636 to
e320939
Compare
|
Ok, I've switched the config to an object and added a timeout, and posted answers/thoughts to many of my original questions |
Fixes microsoft#42092 Adds a way to run code actions on save using the `editor.codeActionsOnSave` setting. This setting lists code action kinds to be executed automatically when the document is saved.
e320939 to
0ae090c
Compare
|
Is there a way to use this setting to convert indentation to spaces automatically on save? I tried adding "editor.codeActionsOnSave": {
"editor.action.indentationToSpaces": true
}to my settings and it didn't do anything, because
|
|
Jesse (@GammaGames) Do you have an extension that contributes a |
|
This feature is only about code actions, not commands. The command names make this a little confusing but they are not code actions (but extensions can convert commands to code actions very easily) |
|
Oooh, my bad! Thank you! |

Fixes #42092
Adds a way to run code actions on save using the
editor.codeActionsOnSavesetting. This setting lists code action kinds to be executed automatically when the document is saved.TODO / Questions:
source.code actions? (This is what it is doing currently actually) A: yes i still think this makes the most sense. We pass the entire document range when requesting these code actions. We can relax this restriction if it causes problems for extension authors