Skip to content

Operators expressions: keep 1st operand on 1st line? #1161

@jods4

Description

@jods4

Input:

bool isGlobal = some_random_condition_that_is_not_so_short()
  || or_else_some_other_condition_that_makes_this_line_long________;

int total = lets_do_a_long_sum__________
  + 42_000_000
  + another_summand____________________
  + last_one;


int total = lets_do_a_long_sum__________
  + 42_000_000
  + another_summand____________________
  + last_one_that_makes_this_excessive;

Output:

// Formatted by 0.27.2

bool isGlobal =
    some_random_condition_that_is_not_so_short()
    || or_else_some_other_condition_that_makes_this_line_long________;

int total =
    lets_do_a_long_sum__________ + 42_000_000 + another_summand____________________ + last_one;

int total =
    lets_do_a_long_sum__________
    + 42_000_000
    + another_summand____________________
    + last_one_that_makes_this_excessive;

Expected behavior: I tend to prefer the input, but that could be debatable?

With current format I don't like how:

  • the first line remains almost empty
  • the first operand visually seems dedented with respect to operators on following lines

I realise that, once more, this would break the Rectangle Rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions