dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Multi-line binary expression in call args causes closing paren to be placed on same line as last arg

Open jakebailey opened this issue 2 years ago • 2 comments

Describe the bug

dprint-plugin-typescript version: 0.86.1

Input Code

forEach(arr, f =>
    a()
    && b()
);

Expected Output

Maybe...

forEach(arr, f => a() && b());

forEach(
  arr,
  f => a() && b()
);

Actual Output

forEach(arr, f =>
  a()
  && b());

Playground Link

Truthfully, I'm not sure what the bug is here, but it seems a little odd to me in the first code snippet that the paren would get moved up a line.

See also: https://github.com/microsoft/TypeScript/pull/54820#discussion_r1246068978

jakebailey avatar Aug 14 '23 18:08 jakebailey

FWIW, you can manually fix this by moving the binary expression to be on one line or by moving the first parameter to the second line if you want it on multiple lines.

dsherret avatar Aug 14 '23 18:08 dsherret

Indeed, I'm just trying to close the loop on all of the "oddities" on the TS PR before we merge it and forget about them.

jakebailey avatar Aug 14 '23 18:08 jakebailey