Poll/discussion: dfmt option for single vs double indents for multi-line code
An Pham
home at home.com
Mon Jan 1 10:26:51 UTC 2024
On Friday, 29 December 2023 at 09:08:33 UTC, Prajwal S N wrote:
> Hi everyone,
>
> As a part of SAOC 2023, I've been working on porting dfmt to
> use the AST from DMD instead of libdparse (you might have come
> across my weekly updates). There are a few passes in the
> original dfmt that seem to allow for a purely aesthetic
> formatting inconsistency, and I wanted some community opinion
> on whether these should be made available in dmdfmt, or whether
> it would be better to retire them.
>
> - `dfmt_single_template_constraint_indent`: If set to true,
> indents multi-line template constraints with a single tab. The
> default is false. E.g.
> ```d
> // default
> void foo(T)()
> if (is(T == char) || is(T == dchar))
> // true
> void foo(T)()
> if (is(T == char) || is(T == dchar))
> ```
> - `dfmt_single_indent`: If set to true, indents multi-line
> function declarations with a single tab. The default is false.
> E.g.
> ```d
> // default
> void foo(int a, char b, string c, int d,
> char e, string f) {}
> // true
> void foo(int a, char b, string c, int d,
> char e, string f) {}
> ```
>
> What do you think about this? Would it be better to maintain a
> single standard for indentation and not allow configuration, or
> should a knob be provided at the cost of consistency?
Why not using 'int' instead as type for number of tabs. For
template restriction, I do not want any tab
More information about the Digitalmars-d
mailing list