haxe-formatter icon indicating copy to clipboard operation
haxe-formatter copied to clipboard

Add wrapping configuration for comparison operators

Open One-Nose opened this issue 2 years ago • 1 comments

Describe the Feature
There is no way to configure wrapping for comparison operators, to allow prettier long if conditions. I have this code:

if (this.actionsByPriority.indexOf(action) < this.actionsByPriority.indexOf(availableAction) {}

Desired output

if (
    this.actionsByPriority.indexOf(action) <
    this.actionsByPriority.indexOf(availableAction)
) {}

One-Nose avatar Feb 11 '24 15:02 One-Nose

can't say I find your desired output easier to read, especially if you had multiple compare operations in a single if condition.

what would look prettier is to extract those terms into variables before comparing, but that is beyond the scope of a formatter.

AlexHaxe avatar Feb 11 '24 16:02 AlexHaxe