git cl format should add parentheses if needs |
|||
Issue description
Suppose we have:
if (condition)
longLongLongLine(blarblarblar,,,,)
else
longLongLongLine(blarblarblar,,,,)
git cl format changes it to
if (condition)
longLongLongLine(
blarblarblar,,,,)
else
longLongLongLine(
blarblarblar,,,,)
However, both lines inside the if-else statement should be wrapped with parentheses.
,
Jan 22 2017
I thought we had a bug for this already, but I can't find it. dcheng might know what I mean. clang-format (mostly) just does whitespace adjustment and doesn't add new tokens per original design. I think I also remember someone saying that this is a hard problem for some reason.
,
Jan 22 2017
This is filed upstream as https://llvm.org/bugs/show_bug.cgi?id=26215. I talked with djasper@ about implementing this, and it's definitely non-trivial. However, if someone's interested in poking at this, I have a few notes from djasper@ about how we could proceed. Otherwise... I'll try to poke at it when I have time, but it probably won't be soon =/
,
Feb 3 2017
When we implement this, it'd be cool if clang-format could try to infer the {} style for single-line ifs (do they have braces or not) from other ifs in that file and then adapt that style, so that ifs in a file get a consistent style too.
,
Oct 26 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by estaab@chromium.org
, Jan 20 2017Components: -Infra>Platform
Labels: Build-Tools