How to set the code format of IntelliJ IDEA to the Code Style required by the company

Generally, large projects may be split into many sub-projects, and each sub-project is developed collaboratively by many people. In order to finalize the integration and facilitate later maintenance, the general company will require a unified code format, so a unified code format file will be issued to standardize the code format xml. , the approximate content format is as follows:

<code_scheme name="MY-PROJECT-Code-Style" version="173">
  <option name="OTHER_INDENT_OPTIONS">
    <value>
      <option name="CONTINUATION_INDENT_SIZE" value="4" />
    </value>
  </option>
  <option name="RIGHT_MARGIN" value="100" />
  //.....省略N多配置
</code_scheme>

Then all we need to do is IntelliJ IDEA perform the following operations:

How to set the code format of IntelliJ IDEA to the Code Style required by the company

Import the configured xml file, and then we can javause the shortcut keys to format the code in the file Ctrl+Alt+L.

This article was first published on Pan Ziye’s personal blog: https://www.panziye.com/java/3244.html

Guess you like

Origin blog.csdn.net/mixika99/article/details/119513004