Why I'm skeptical of auto-formatting

Dennis dkorpel at gmail.com
Fri May 3 08:33:16 UTC 2019


On Friday, 3 May 2019 at 07:48:14 UTC, JN wrote:
> I have my VSCode setup to run dfmt on the code on each save, so 
> that my code is formatted properly each time.

I used such a setup for a TypeScript project, it was nice that it 
automatically enforced the strict 80-columns limit and made long 
object literals or function calls look better. There was one time 
where the linter didn't agree with the result of the formatter, 
which was pretty funny.

In a C# project the formatter could also sort class field 
alphabetically, which turned a nice order of:
x0
y0

x1
y1

into:
x0
x1
y0
y1

For D I don't find it hard to write well-formatted code, the only 
help from a formatter I would want is splitting up long 
signatures with template constraints or word-wrapping 
documentation comments (since anytime I insert/remove a word on a 
line all following lines need to be adjusted).


More information about the Digitalmars-d mailing list