[PATCH] D132131: [clang-format] Adds a formatter for aligning trailing comments over empty lines

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 02:09:56 PDT 2022


MyDeveloperDay added a comment.

> But you could set MaxEmptyLinesToKeep to 3 and aligning comments to over 2 empty lines.

Correct! lets assume MaxEmptyLinesToKeep  = 3

if this case is valid in that case

  int a;            // Foo
  int longer foo;   // Foo
  int verylong foo; // Foo

then so is this

  int a;            // Foo
  
  int longer foo;   // Foo
  
  int verylong foo; // Foo

and so is this...

  int a;            // Foo
  
  
  int longer foo;   // Foo
  
  
  int verylong foo; // Foo

but not this

  int a;          // Foo
  
  int longer foo; // Foo
  
  
   
  int verylong foo; // Foo

Regardless of how many lines I am willing or not willing to keep, I know it feels orthogonal, but its actually independent (so don't use it as my setting), or you could manipulate code in a way I don't want changed (and they people will complain)

Its one of those cases there it feels like they can be the same, but the answer is should they? or are we making an assumption about what people want rather than giving them the control.

I agree if OverEmptyLines > MaxEmptyLinesToKeep  then it feels kinda odd (but what about lines that are // clang-format off'd should we count those?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132131/new/

https://reviews.llvm.org/D132131



More information about the cfe-commits mailing list