If I set "wrap when typing reaches right margin" in Cody Style
-> General
preferences and defined a new margin, how to apply this new settings to files so they were reformatted?
In order to wrap text in the code editor in IntelliJ IDEA 2020.1 community follow these steps: Ctrl + Shift + "A" OR Help -> Find Action Enter: "wrap" into the text box Toggle: View | Active Editor Soft-Wrap "ON" In the latest IntelliJ, version 2020, we have an option called soft-wrap these files:
Use Find Action ( ⇧⌘A or Shift+Ctrl+A ), and start typing “rearrange” to find the rearrange code action. Select this and IntelliJ IDEA will reorder the code of this class according to the settings for the project. We can see all the fields are placed at the top of the file and the getters and setters for a field are placed next to each other.
In the latest IntelliJ, version 2020, we have an option called soft-wrap these files: Settings > Editor > General > soft-wrap these files. Check this option and add the type of files you would like to apply the wrapping to. Edit > Macros > Start Macro Recording (the recording will start). Click where you need.
These formatting settings are stored in a settings file in the project’s .idea folder. IntelliJ IDEA also supports using an EditorConfig file to define the code style. Create a new EditorConfig file in a package or directory. This will be our root, add the standard EditorConfig properties and IntelliJ IDEA-specific settings for Java code.
Very easy:
EDIT
Forgot to mention this important detail:
IDE Settings > Code Style > Java > Wrapping and braces > Ensure right margin is not exceeded
must be checked. (at least to reformat java files, same checkbox for other files exists)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With