intellij-ideacode-formatting

How to have the formatter wrap code with IntelliJ?


I'm not able to format my code in IntelliJ.

I can see the margin line (by default at 120 columns) but it seems that the activation from the menu:

Code -> Reformat Code

is just ignoring this margin.


Solution

  • Do you mean that the formatter does not break long lines? Then please check:

    Settings / Project Settings / Code Style / Wrapping

    Update: In later versions of IntelliJ, the option can be found under:

    Settings / Editor / Code Style

    There select Wrap when typing reaches right margin.