[PATCH] D132131: [clang-format] Adds a formatter for aligning trailing comments over empty lines
Yusuke Kadowaki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 15 07:52:19 PDT 2022
yusuke-kadowaki added inline comments.
================
Comment at: clang/docs/ClangFormatStyleOptions.rst:865
+
+ * ``TCAS_DontAlign`` (in configuration: ``DontAlign``)
+ Don't align trailing comments.
----------------
HazardyKnusperkeks wrote:
> yusuke-kadowaki wrote:
> > HazardyKnusperkeks wrote:
> > > MyDeveloperDay wrote:
> > > > yusuke-kadowaki wrote:
> > > > > MyDeveloperDay wrote:
> > > > > > Is Don'tAlign the same as Leave that other options support (for options it best if we try and use the same terminiology
> > > > > >
> > > > > > Always,Never,Leave (if that fits)
> > > > > IMHO, `Leave` probably fits but `DontAlign` is more straightforward. Also `DontAlign` is used for other alignment styles like `BracketAlignmentStyle` so it would be more natural.
> > > > Leave should mean do nothing.. I'm personally not a fan of DontAlign because obvious there should be a ' between the n and the t but I see we use it elsewhere
> > > >
> > > > But actually now I see your DontAlign is effectively the as before (i.e. it will not add extra spaces)
> > > >
> > > > The point of Leave is what people have been asking for when we introduce a new option, that is we if possible add an option which means "Don't touch it at all" i.e. if I want to have
> > > >
> > > > ```
> > > > int a; // abc
> > > > int b; /// bcd
> > > > int c; // cde
> > > > ```
> > > >
> > > > Then so be it
> > > >
> > > >
> > > Leave is a nice option, yes.
> > > I think it is complementary to `Dont`.
> > >
> > > But maybe if the option is called `AlignTrailingComments` one may interpret `Leave` not as "don't touch the position of a comment at all" (what do we do, if the comment is outside of the column limit?), but as "just don't touch them, when they are somewhat aligned". Just a thought.
> > > Leave should mean do nothing
> >
> > Ok now I see what `Leave` means.
> > But that should be another piece of work no?
> >
> > Of course me or someone can add the feature later (I don't really know how to implement that though at least for now)
> >
> >
> Fine by me.
@HazardyKnusperkeks
Is this complicated? If it's not I might as well do this.
Also it would be helpful if you could provide some implementation guidance. Sorry to ask this even though I haven't tried it myself yet.
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