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/docs/reference/other-new-features/indentation.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,18 +159,17 @@ Indentation prefixes can consist of spaces and/or tabs. Indentation widths are t
159
159
160
160
###Indentation and Braces
161
161
162
-
Indentation can be mixed freely with braces and parentheses.For interpreting indentation inside braces and parentheses, the following rules apply.
162
+
Indentation can be mixed freely with braces `{...}`, aswellasbrackets `[...]` and parentheses `(...)`.For interpreting indentation inside such regions, the following rules apply.
163
163
164
164
1. The assumed indentation width of a multiline region enclosed in braces is the
165
165
indentation width of the first token that starts a new line after the opening brace.
166
166
167
-
2. The assumed indentation width of a multiline region inside parentheses is:
167
+
2. The assumed indentation width of a multiline region inside brackets or parentheses is:
168
168
169
-
-if the opening parenthesis is at the end of a line, the indentation width of token following it,
169
+
-if the opening bracket or parenthesis is at the end of a line, the indentation width of token following it,
170
170
- otherwise, the indentation width of the enclosing region.
171
171
172
-
3. On encountering a closing brace `}` or parenthesis `)`, asmany `<outdent>` tokens asnecessary are
173
-
inserted to close all open indentation regions inside the pair of braces or parentheses.
172
+
3. On encountering a closing brace `}`, bracket `]` or parenthesis `)`, asmany `<outdent>` tokens asnecessary are inserted to close all open nested indentation regions.
174
173
175
174
For instance, consider:
176
175
```scala
@@ -190,8 +189,7 @@ statement starting with `val`).
190
189
parenthesis is not at the end of a line.
191
190
-The indentation width of the region in parentheses around `y + 1` is 9
192
191
(i.e. the indentation width of `y + 1`).
193
-
-Finally, the indentation width of the last region in parentheses starting with`(x` is 6 (i.e. the indentation
194
-
width of the indented region following the `=>`.
192
+
-Finally, the indentation width of the last region in parentheses starting with`(x` is 6 (i.e. the indentation width of the indented region following the `=>`.
0 commit comments