eclipse设置代码模板和格式

该设置可以在保存文件时自动根据模板调整代码格式。

首先准备华为代码格式化文件:

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



原文地址:https://www.cnblogs.com/xyhero/p/90f7867f5e910072ee30b4a8e3fc95e1.html