Skip to main content

Blank lines

blankLines says what happens to the empty lines you wrote: between the items of a list, between clauses, between statements. It has three values.

Default: keep_one. An empty line is read as grouping. It survives, and a run of several collapses to one. Two empty lines between two select items say nothing that one does not, but zero would erase the group, and dfmt does not know why you grouped. This is the one piece of your layout the formatter keeps without being asked; even preserveBreaks at off keeps it.

keep_all keeps each run with its count: three empty lines stay three. It is for a project that uses the size of a gap to mean something, or one that wants a reformat to touch no empty line at all.

none discards your empty lines. Only the ones another option asks for appear: linesBetweenStatements between statements, blankLineBetweenCtes between CTEs. Choose it when the output should depend on the SQL alone and not on how it was typed; a group you had marked with an empty line is then laid out like any other list, and a short one collapses onto one line.

A run of three empty lines, under each value​

select
    a,



    b
from t
select
    a,

    b
from t
select
    a,



    b
from t
select
    a,



    b
from t
select
    a,



    b
from t
select a, b from t