You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/auto_format_rule.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ Never derive structural depth from:
76
76
77
77
## 4. Sibling frames keep the first child inline
78
78
79
-
For list and condition frames:
79
+
The default `Stacked` layout for list and condition frames is:
80
80
81
81
- the first direct child remains on the owner line;
82
82
- the second and later children start new lines at the frame depth;
@@ -99,6 +99,34 @@ operator advances only its innermost owning frame.
99
99
A later separator must not retrospectively move or partially rewrite the first
100
100
child.
101
101
102
+
The `Wrapped` comma-list preference changes only eligible comma separators in
103
+
ordinary lists. The formatter keeps the next child inline when its canonical
104
+
single-line width fits the configured right margin; otherwise that child starts
105
+
a new line at the same frame depth. Structural separators, CTE siblings,
106
+
multiline children, comments, and dedicated `CREATE TABLE` column/partition
107
+
layouts keep their required line breaks in both modes.
108
+
109
+
### 4.1 Comma-list preferences
110
+
111
+
The Preferences dialog exposes these settings under `SQL Formatting`:
112
+
113
+
| Setting | Values | Default | Contract |
114
+
| --- | --- | --- | --- |
115
+
|`Comma Lists`|`Stacked`, `Wrapped`|`Stacked`|`Stacked` always breaks before the second and later eligible children. `Wrapped` keeps adding children while they fit the right margin. |
116
+
|`Right Margin`|`60` through `300` columns |`120`| Used only by `Wrapped`. It is a comma-break target, not a hard text-splitting boundary. |
117
+
118
+
The right-margin calculation includes the existing line prefix, indentation,
119
+
comma, following space, and the next child's inline width. A child that cannot
120
+
be split safely may exceed the margin. Changing the editor window width does
121
+
not change formatting output.
122
+
123
+
The comma-list preference applies to ordinary `SELECT`, `FROM`, `SET`,
124
+
`VALUES`, `GROUP BY`, `ORDER BY`, `WINDOW`, `INTO`, `USING`, `RETURNING`, and
125
+
direct parenthesized lists such as function arguments, `IN (...)`, insert
126
+
columns, and row values. It does not override grammar-required line breaks,
127
+
CTE separators, comments, multiline `CASE` or subqueries, trigger/grant syntax,
128
+
or dedicated `CREATE TABLE` column and partition formatting.
129
+
102
130
## 5. Structural body boundaries are separate frames
103
131
104
132
The first-child-inline rule applies to sibling-bearing list and condition
0 commit comments