[PATCH] D139029: [clang-format] Don't move comments if AlignTrailingComments: Kind: Leave

MaĆ­ra Canal via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 12:56:31 PST 2022


mairacanal added a comment.

In D139029#3961446 <https://reviews.llvm.org/D139029#3961446>, @HazardyKnusperkeks wrote:

> In D139029#3961444 <https://reviews.llvm.org/D139029#3961444>, @HazardyKnusperkeks wrote:
>
>> In D139029#3961438 <https://reviews.llvm.org/D139029#3961438>, @mairacanal wrote:
>>
>>> In D139029#3961372 <https://reviews.llvm.org/D139029#3961372>, @HazardyKnusperkeks wrote:
>>>
>>>> Can you please add a test with more than one newline?
>>>
>>> Hi @HazardyKnusperkeks! Thanks for the feedback. It looks like `Changes[i].NewlinesBefore` values 1 even if I put multiple lines before the comment. Do you have any input on what could be causing this? From my point of view, it looks like the extra new lines are being removed before `alignTrailingComments` and then `Changes[i].NewlinesBefore = 1`, but I'm not really sure how to solve it.
>>
>> Try setting `MaxEmptyLinesToKeep` to a higher number.
>
> We can also use two additional test cases, with `MaxEmptyLinesToKeep` and without, always good to see that it works.

If I don't set  `MaxEmptyLinesToKeep` to a higher number, then Changes[i].NewlinesBefore = 1 and some spaces will be added by the beginning of the line. Can I just create the test case with  `MaxEmptyLinesToKeep`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139029



More information about the cfe-commits mailing list