Allow autoSave and formatOnSave #45997
Comments
I agree with you. |
|
Any news about this issue? It can be very helpful... |
|
+1 This feature would be awesome. |
|
Might be related: it doesn't say it for |
|
I would paraphrase the request a bit: How can we get the functionality a setting named At the moment I am struggling to make Prettier format code as soon as I change focus which triggers auto-save. Both work on their own, but do not work together. expected result: actual result: edit: We could manage to hack together a solution using this extension and prettier's command line interface, but why should all other less hack-wise users stay affected by this bug? |
This is not true. Having However, I agree that If you try to make a keybinding |
At least this is my understanding. |
|
@lopsch oh sorry by "editor.codeActionsOnSave": {
"source.fixAll.tslint": true
},
"editor.formatOnSave": true,
"files.autoSave": "onFocusChange",And it works just fine. At least from VSCode side. Sometimes it happened that So I don't see any problem here, actually. And...
It's already working in such a way. Both Prettier (which is controlled by So I think this issue should be closed. |
|
This feature isn't yet implemented @JerryGreen To reproduce:
However, if you save the file manually by pressing |
|
@andrecasal oh, that's true, - just checked this setting. It does not work together. It has something to do with |
|
For me it is very important part of developer experience. I know it is already possible to hack some linters to get the code formatted for you. For example Prettier + TSLint or rust-lang can do that. As described above this should be possible for all formatters using simple setting. Is there a chance to get official response from team on this issue please? I see @jrieken is now assigned to the issue. |
|
+1 for this feature and suprising that it is not possible at the moment considering awsome vscode. |
|
+1 Note that some formatters take a substantial time to execute and editing experience could quickly become annoying, so the current behavior is not unsound. |
|
Yup, would be nice to have this feature, 2 years later... |
|
We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
|
"We are happy to listen and to reconsider." - Please reconsider. Fair amount of up votes. What's the main concern with implementing this? Performance? |
|
What's worse is that if you manually save after the auto save delay then it doesn't run the formatter either (#119857). |
|
I don't see why we still don't have this option in vscode. If the concern on implementing this is about performance, then that's why it's an option, like any other performance impacting options. |
|
How can we get it to be added as a feature? |
|
I literally discover the "AutoSave" setting today, and instantly I started searching "how to format on autosave" and now I'm commenting on this thread... so if you can see... "format on auto save" is a real need. |
|
In the same boat here, somehow missed that autosave was a thing, discovered it is, tried to make it work with format on save and no go. I know very little about the inner-workings of VSCode since I've had little interest in that aspect of it so I'm not sure if a better workaround exists, but in the meantime the quickest solution I've found is using an extension that forces the format command. The extension in question: Run on Save Then in your settings.json add something along the lines of:
Enable |
|
Hi, "format on auto save after delay" is a real need indeed. |
As we wait for this feature.This hack by @ktvdev works |
VS Code documentation regarding configuration says that formatOnSave only works when autoSave is turned off.
The formatOnSave config:
and the autoSave config:
Both live inside the user settings.
It would be a great developer experience to have files automatically saved AND format the documents automatically.
There's a closed issue with a similar title #37820, but the author was looking to solve an extension bug and it got closed when it was solved. I think this issue remains an important feature request.
The text was updated successfully, but these errors were encountered: