eclipse-archived / ceylon.formatter

A formatter for the Ceylon programming language, written in Ceylon.
Apache License 2.0
14 stars 11 forks source link

Change indentBlankLines to false by default #150

Open lucaswerkmeister opened 6 years ago

lucaswerkmeister commented 6 years ago

Indenting blank lines was really important to me for some reason when I started working on the formatter, so the indentBlankLines option has always defaulted to true. But this isn’t really conventional in any other language, and it makes it annoying to edit Ceylon code in other editors, since they usually assume that you don’t want to indent empty lines (e. g. Emacs will remove indentation when you press Enter after a blank line), and Git shows it as a formatting error, etc. etc. etc.

Basically, I feel that we’re going against all conventional wisdom of computer science, with no real arguments on our side (for me at least it was never more than a vague feeling of consistency). So for the next major release, I’d suggest changing this default behavior, and not indenting blank lines by default (though you’ll still be able to enable the indentBlankLines option explicitly, of course).

Any comments? What do you think?

jvasileff commented 6 years ago

I realize as a practical matter this could result in longer diffs for the Ceylon codebase, but:

So I think false by default is much better. true is basically a special Eclipse whitespace mode for projects that don’t choose to remove trailing whitespace on save.

CPColin commented 6 years ago

I like indenting blank lines because I feel the cursor moves more consistently as I'm navigating around. Plus, I don't have to hit Tab before I start typing. But I'd be fine with changing the default, though I'd probably immediately turn the option back on.