How DevEco Studio formats the code (basic knowledge of HarmonyOS development)

How to format the code

Supports code formatting operations on the selected range of codes or the current entire file, which can improve the beauty and readability of the code.

  • Use the shortcut key Ctrl + Alt + L to quickly format the code in the selected range.
  • Use the shortcut Ctrl + Alt + Shift + L to quickly format the entire file.

If you do not need to perform automatic formatting for some code fragments when formatting, you can set it in the following ways:

  • First, in File>Settings>Editor>Code Style, click "Formatter Control" and check "Enable formatter markers in comments".
  • Second, in Java or C/C++ code, add “//@formatter:off” before the code block that does not require formatting operations, and add “//@formatter:on” at the end of the unformatted code block. It means that the code block in this range does not need to be formatted.

For more technical exchanges, please join the QQ group

Group name: harmonyos Hongmeng Technology Exchange
Group number: 856567895


Start from scratch to learn HarmonyOS Hongmeng 2.0 development

Guess you like

Origin blog.csdn.net/iCloudEnd/article/details/108587336