PabloRMira / sql_formatter

A Python based SQL formatter
https://pablormira.github.io/sql_formatter/
Apache License 2.0
43 stars 10 forks source link

case when wrongly formatted if comment after first condition #100

Closed PabloRMira closed 3 years ago

PabloRMira commented 3 years ago

something like

select asdf,
case when asdf = 1 and -- some comment
asdf != 2 then 1 else 0 end as some_field
from table1

would be formatted like

select asdf,
       case when asdf = 1 and -- some comment
            asdf != 2 then 1 else 0 end as some_field
from table1

and not better like

select asdf,
       case when asdf = 1 and -- some comment
                 asdf != 2 then 1 else 0 end as some_field
from table1