HazardyKnusperkeks wrote:

> > I have to quote this, because I think this is an uncommon formatting style, 
> > with many possible ways to expect something different from the output. It 
> > also violates (although documented) the `ColumnLimit`.
> 
> I do not see this as a _new_ formatting style, but as something that allows 
> more formatting consistency with the existing options available. Similarly to 
> how `AcrossComments` allows consistent alignment when there are comments on 
> separate lines between things, this option allows consistent alignment when 
> there are trailing comments between things. Is there a style guide that 
> specifically states that declarations should be aligned across line comments 
> in between? If not, perhaps a different standard should be applied here. 
> Although, the only standard that isn't satisfied here would be a public style 
> guide since my company does not provide source code publicly, and thus does 
> not publish its coding style guide.
> 
> Would limiting this to only declarations change your thinking here? I figured 
> there wasn't anything special in the code that would limit this option to 
> only declarations, so I didn't, but my motivating use case is only for 
> declarations like the examples given.
> 
> > Let me ask, do you really need trailing comments, can't you just put the 
> > comments on their own line?
> > We are formatting large amounts of existing code, and generally 
> > clang-format's alignment options work just fine except in the presences of 
> > trailing comments. Moving these comments to their own line would be a 
> > prohibitive amount of work.

The thing is, it is not really consistent. If I would use this (and didn't know 
about the clang-format internals) I would be really surprised that the comment 
will we wrapped at the column limit before alignment, and then shifted, because 
something else was aligned and now is beyond the column limit. Why not wrap the 
comment at an earlier point so that it doesn't move outside of the column limit?

Why do all alignments stop at the column limit, but a comment should be handled 
differently?

Limiting it to declarations does not change anything (or would be even more 
surprising, if the declarations are aligned, but the assignments in the same 
lines are not, just because of the comment).

@owenca @mydeveloperday I would like your opinions on that matter.

https://github.com/llvm/llvm-project/pull/190668
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to