Alignment
Alignment pads tokens so they line up vertically across sibling items. The formatter uses Doc.Align nodes in the document algebra — no string-level post-processing.
AS alignment in SELECT
When alignAs=true, AS keywords in SELECT items are padded to align across siblings.
select customer_id as cust, total_amount as total, very_long_column_name as short from t
select
customer_id as cust, total_amount as total, very_long_column_name as short
from t
AS alignment respects maxLineWidth
When alignment padding would push a line beyond maxLineWidth, alignment is skipped entirely for that group.
select customer_id as cust, total_amount as total, very_long_column_name as short from t
select
customer_id as cust,
total_amount as total,
very_long_column_name as short
from t
AS alignment off by default
Without alignAs=true, items render without padding.
select customer_id as cust, total_amount as total from t
select
customer_id as cust,
total_amount as total
from t
CASE THEN alignment
When alignCaseThen=true, THEN keywords in WHEN branches are padded to align.
select case when x > 1 then 'a' when very_long_condition > 2 then 'b' else 'c' end from t
select
case when x > 1 then 'a' when very_long_condition > 2 then 'b' else 'c' end
from t
CASE THEN alignment respects maxLineWidth
When alignment would exceed width, THEN stays unpadded.
select case when x > 1 then 'a' when very_long_condition > 2 then 'b' end from t
select
case
when x > 1 then 'a'
when very_long_condition > 2 then 'b'
end
from t
Mixed: items with and without AS
Items without AS aliases are unaffected by alignment — only items with AS participate.
select customer_id as cust, total_amount, name as n, another_very_long_column as col from t
select
customer_id as cust,
total_amount,
name as n,
another_very_long_column as col
from t
SET = alignment
When alignTokens includes =, = signs in SET assignments are padded to align.
update t set first_name = 'John', last_name = 'Doe', email_address = 'john@example.com' where id = 1
update
t
set
first_name = 'John',
last_name = 'Doe',
email_address = 'john@example.com'
where id = 1