Eclipse (STS) Enum formatting configuration

need

枚举类The fields are generally small in length. After formatting, multiple fields will become one line.

Requirements: I hope that each field is a separate row.

The formatted style is as shown in the figure below:
insert image description here

configuration

1. Windows - Preferences

insert image description here

2. Java-Formatter

If there is no custom formatter (Java-Formatter), you can create a new one, and then edit Edit. If it already exists, edit it directly.
insert image description here

3. Constants

定位 LineWrapping - WrappingSettings - ‘enum’ declaration - Constants
insert image description here

4. Configure and save.

insert image description here
insert image description here

reference article

When eclipse configures the length of a single line, it displays an unsightly optimization for enumeration class subitems

Guess you like

Origin blog.csdn.net/sgx1825192/article/details/132251738