Is there any way to sort the member variables of an enum alphabetically in IntelliJ? I've been trying a bunch of different settings in the arrangement section but didn't have success. Could anyone maybe help me?
By default, the enumeration column is sorted based on the enum flags. So, the display values of that column are different from the normal column sorting. When you want to sort the enumeration column based on the values displayed, you can handle it by changing the CellValueType of the column as string.
To quickly sort lines alphabetically, select them in the editor and choose Edit | Sort Lines from the main menu. Alternatively, you can run this action using the Find Action command (Cmd/Ctrl+Shift+A).
Type Alt+Enter on an enum constant and invoke the sort content
intention. This will sort the enum constants in alphabetical order. The intention will only appear if the constants are not alphabetically sorted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With