該設置可以在保存文件時自動根據模板調整代碼格式。
首先准備華為代碼格式化文件:
FEFO-Formatter.xml
FEFO-codetemplates.xml
設置格式
Preferences-Java-Code Style-Formatter,右側Import...FEFO-Formatter.xml文件
設置模板
Preferences-Java-Code Style-Code Templates,右側Import...FEFO-codetemplates.xml文件
設置保存動作
Preferences-Java-Editor-Save Actions
右側勾選以下選線:
Perform the selected actions on save Format source code Format all lines Organize imports