Is it possible to tell Clang-Format to ignore comments for line break operations? The idea is to follow the style "the code is well formatted, even if comments exceed the line break margin". Code should not be split in multiple lines, if it does not exceed the margin, but the comment does.
e.g.
//desired behaviour:
short code = shortCode +
longlonglongCode;
short code = shortCode; //long comment without a line break
//not desired behaviour:
short code =
shortCode; //long comment without a line break
ReflowComments: (
bool
)If
true
,clang-format
will attempt to re-flow comments.false: // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */ true: // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of // information /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of * information */
Source
Use ReflowComments: true
, when enabled it will add 1 space after //
and brake comments when reach limit.
You can use PenaltyBreakComment
to adjust.
E.g. block braking lines PenaltyBreakComment: 1000000000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With