Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Parenthesized binary expression #2427

Closed
Tracked by #2403
MichaReiser opened this issue Apr 13, 2022 · 0 comments · Fixed by #3079
Closed
Tracked by #2403

Parenthesized binary expression #2427

MichaReiser opened this issue Apr 13, 2022 · 0 comments · Fixed by #3079
Assignees
Labels
A-Formatter Area: formatter I-Normal Implementation: normal understanding of the tool and awareness

Comments

@MichaReiser
Copy link
Contributor

MichaReiser commented Apr 13, 2022

Prettier doesn't add an additional indent level if a binary expression is wrapped by a parenthesized expression but Rome does. Playground

Input

(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
  bbbbbbbbbbbbbbbbbbbbbbbbb &&
  ccccccccccccccccccccccccc &&
  ddddddddddddddddddddddddd &&
  eeeeeeeeeeeeeeeeeeeeeeeee
)();

(
  aa &&
  bb &&
  cc &&
  dd &&
  ee
)();

// Indent's as usual if it's a parenthesized sequence expression
(
  aaaaaaaaaaaaaaaaaaaaaaaaa +
  bbbbbbbbbbbbbbbbbbbbbbbbb +
  ccccccccccccccccccccccccc +
  ddddddddddddddddddddddddd +
  eeeeeeeeeeeeeeeeeeeeeeeee, "test"
)();

(
  aa +
  bb +
  cc +
  dd +
  ee
)();

(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
  bbbbbbbbbbbbbbbbbbbbbbbbb &&
  ccccccccccccccccccccccccc &&
  ddddddddddddddddddddddddd &&
  eeeeeeeeeeeeeeeeeeeeeeeee
)()()();

// Doesn't apply for call arguments
call(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
)(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
)(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
);

Prettier

(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
  bbbbbbbbbbbbbbbbbbbbbbbbb &&
  ccccccccccccccccccccccccc &&
  ddddddddddddddddddddddddd &&
  eeeeeeeeeeeeeeeeeeeeeeeee
)();

(aa && bb && cc && dd && ee)();

// Indent's as usual if it's a parenthesized sequence expression
(aaaaaaaaaaaaaaaaaaaaaaaaa +
  bbbbbbbbbbbbbbbbbbbbbbbbb +
  ccccccccccccccccccccccccc +
  ddddddddddddddddddddddddd +
  eeeeeeeeeeeeeeeeeeeeeeeee,
"test")();

(aa + bb + cc + dd + ee)();

(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
  bbbbbbbbbbbbbbbbbbbbbbbbb &&
  ccccccccccccccccccccccccc &&
  ddddddddddddddddddddddddd &&
  eeeeeeeeeeeeeeeeeeeeeeeee
)()()();

// Doesn't apply for call arguments
call(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
)(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
)(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
);

Rome

(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
)();

(aa && bb && cc && dd && ee)();

// Indent's as usual if it's a parenthesized sequence expression
(
  aaaaaaaaaaaaaaaaaaaaaaaaa +
    bbbbbbbbbbbbbbbbbbbbbbbbb +
    ccccccccccccccccccccccccc +
    ddddddddddddddddddddddddd +
    eeeeeeeeeeeeeeeeeeeeeeeee, "test"
)();

(aa + bb + cc + dd + ee)();

(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee
)()()();

// Doesn't apply for call arguments
call(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee,
)(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee,
)(
  aaaaaaaaaaaaaaaaaaaaaaaaa &&
    bbbbbbbbbbbbbbbbbbbbbbbbb &&
    ccccccccccccccccccccccccc &&
    ddddddddddddddddddddddddd &&
    eeeeeeeeeeeeeeeeeeeeeeeee,
);

Expected

Rome's formatting to match Prettier's

@MichaReiser MichaReiser changed the title Binary expression in call arguments Parenthesized binary expression Apr 13, 2022
@MichaReiser MichaReiser added the A-Formatter Area: formatter label Apr 13, 2022
@ematipico ematipico self-assigned this May 4, 2022
@ematipico ematipico added the I-Normal Implementation: normal understanding of the tool and awareness label May 5, 2022
@ematipico ematipico removed their assignment May 5, 2022
@yassere yassere self-assigned this May 31, 2022
@MichaReiser MichaReiser assigned MichaReiser and unassigned yassere Aug 8, 2022
@MichaReiser MichaReiser mentioned this issue Aug 11, 2022
17 tasks
@MichaReiser MichaReiser linked a pull request Aug 18, 2022 that will close this issue
@MichaReiser MichaReiser moved this to Done in Rome 2022 Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter I-Normal Implementation: normal understanding of the tool and awareness
Projects
Status: Done
3 participants