How to correct indentation in IntelliJ

后端 未结 7 1626
逝去的感伤
逝去的感伤 2020-12-04 10:18

How can indentation be automatically (not manually) corrected in IntelliJ?

In Eclipse, it\'s possible to just highlight the code that needs indenting, right-click, a

7条回答
  •  攒了一身酷
    2020-12-04 11:06

    CodeReformat Code... (default Ctrl + Alt + L) for the whole file or CodeAuto-Indent Lines (default Ctrl + Alt + I) for the current line or selection.

    You can customise the settings for how code is auto-formatted under FileSettingsEditorCode Style.


    To ensure comments are also indented to the same level as the code, you can simply do as follows:

    (example for JavaScript)

提交回复
热议问题