Skip to main content

IN List Formatting

Break IN (...) value lists vertically when the list exceeds maxLineWidth.

Default: inListNewline=width_aware — breaks when list exceeds maxLineWidth. When breaking, preserves the user's original items-per-line grouping if consistent. Always: inListNewline=always — always breaks vertically (one item per line). Never: inListNewline=never — always stays inline.

Default (width-aware): short list stays inline

select a from t where x in (1, 2, 3)
select a from t where x in (1, 2, 3)

Always: short list breaks vertically

select a from t where x in (1, 2, 3)
select a from t where x in (1, 2, 3)

Never: long list stays inline

select a from t where x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
select a from t where x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

Width-aware: long list breaks

select a from t where x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
select a
from t
where
x in (
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15
)

IN with subquery — not affected

IN with a subquery uses subquery formatting, not IN list formatting.

select a from t where x in (select b from t2)
select a from t where x in (select b from t2)

Width-aware adaptive: preserves 4-per-line grouping

When the input has consistent items-per-line grouping (detected from newlines in original trivia), the formatter preserves that grouping.

select a from t where x in (1, 2, 3, 4,
5, 6, 7, 8,
9, 10)
select a
from t
where
x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

Width-aware adaptive: preserves 3-per-line grouping

select a from t where x in (1, 2, 3,
4, 5, 6,
7, 8, 9,
10)
select a
from t
where
x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

NOT IN with always

select a from t where x not in (1, 2, 3)
select a from t where x not in (1, 2, 3)