Skip to content

comma_first option for reindent_aligned would be sweet #490

Open

Description

@tym-xqo

Title more or less says it all.

While I am thrilled that this library has the aligned indent option, which is something I've been searching for in a SQL formatter, I'm also from the commas-first school. In fact, this works even better with aligned indentation, as the commas line up right under the keywords, with the identifiers and literals on the right all by themselves.

For example:

select j.jobtitle
     , count(*)
     , max(orig_salary) maxsalary
     , min(orig_salary) minsalary 
     , rank() over(order by max(orig_salary)) rankorder
  from employee e
     , job j
 where e.orig_salary < 43000
   and e.empno = j.empno
 group by j.jobtitle
having max(orig_salary) > 34000
 order by j.jobtitle desc
;

I think this format also makes semantic sense, as the commas are really syntactic elements as much as the keywords are. YMMV, but in any case I for one would love to be able to get this format automatically, which neither the aligned indent nor regular reindent with comma_first quite does now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions