quarylabs / sqruff

Fast SQL formatter/linter
https://playground.quary.dev/?secondary=Format
Apache License 2.0
397 stars 14 forks source link

Support aligning aliases #983

Open matthias-Q opened 16 hours ago

matthias-Q commented 16 hours ago

Hi, it would be nice if you could support aligning aliases Before:

select
    aaaa as a,
    bbb as b,
    cc as c
from table

After:

select
    aaaa as a,
    bbb  as b,
    cc   as c
from table

At the moment this conflicts with rule LT01.

Thanks.

gvozdvmozgu commented 15 hours ago

It seems to be working with this configuration, but I'm getting strange "TODO" diagnostics on the playground.

[sqlfluff:layout:type:alias_expression]
spacing_before = align
align_within = select_clause
align_scope = bracketed
benfdking commented 14 hours ago

What are the TODOs @gvozdvmozgu, I don't see them?

If this works, it might be worth adding a docs document for example configs.

gvozdvmozgu commented 13 hours ago

image I can't remember—was it just that we didn't write the diagnostic text, or was there something deeper?

matthias-Q commented 11 hours ago

Ah thanks. That helps alot