How to have the formatter wrap code with IntelliJ?

后端 未结 7 1233
梦谈多话
梦谈多话 2020-12-22 17:31

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:

7条回答
  •  生来不讨喜
    2020-12-22 18:12

    Enabling "Ensure right margin is not exceeded" doesn't work for me in Intellij IDEA 2018.2. I have found the workaround, we need to change every elements below from "Do not wrap" to "Wrap if long".

    After that, we can preview what kind of wrap type will be changed by looking into right panel. If we are satisfied, Click "OK" or "Apply" to apply the changes. Finally we need a mannual format by using CTRL+ ALT+ L in Windows and Command+ Shift+ L in MacOS.

提交回复
热议问题