admin管理员组文章数量:1391956
- Actions on save -> checked,
- Reformat changed lines -> checked
- Optimize imports -> checked.
This works excellently most of the time, but sometimes I want my own formatting to remain.
I seem to remember that if you do Cmd + Z immediately after save, the IDE would revert the auto code formatter and save the file (maybe from Eclipse?) But IntelliJ undoes the reformatting and marks the file as unsaved, when saving it will do the reformat again. I press Cmd + Z again, code is how I want it, Cmd + S auto format again. I failed to find a way out of this loop, unless I disable "reformat changed lines" from "actions on save". But most of the time I want that.
How can I undo the auto reformat and save the file? I don't want to use formatter markers.
- Actions on save -> checked,
- Reformat changed lines -> checked
- Optimize imports -> checked.
This works excellently most of the time, but sometimes I want my own formatting to remain.
I seem to remember that if you do Cmd + Z immediately after save, the IDE would revert the auto code formatter and save the file (maybe from Eclipse?) But IntelliJ undoes the reformatting and marks the file as unsaved, when saving it will do the reformat again. I press Cmd + Z again, code is how I want it, Cmd + S auto format again. I failed to find a way out of this loop, unless I disable "reformat changed lines" from "actions on save". But most of the time I want that.
How can I undo the auto reformat and save the file? I don't want to use formatter markers.
Share Improve this question edited Mar 14 at 7:35 jonrsharpe 122k30 gold badges268 silver badges476 bronze badges asked Mar 14 at 7:29 Bogdan PopBogdan Pop 1016 bronze badges1 Answer
Reset to default 0You need to do the setting to remove that behavior first, that you can find at
Settings > Tools > Actions on Save
Uncheck the Reformat code , you can pick some file types to apply this or not.
本文标签: intellij ideaHow to revert auto formatting changed lines and save the fileStack Overflow
版权声明:本文标题:intellij idea - How to revert auto formatting changed lines and save the file - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744669251a2618723.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论