@@ -566,19 +566,20 @@ object Scanners {
566
566
* - current line starts with a token that can start a statement
567
567
* - current line does not start with a leading infix operator
568
568
* The answer is different for Scala-2 and Scala-3.
569
- * - In Scala 2: Only `{` is treated as continuing, irrespective of indentation.
570
- * But this is in fact handled by Parser.argumentStart which skips a NEWLINE,
571
- * so we always assume false here.
572
- * - In Scala 3: Only indented statements are treated as continuing, as long as
573
- * they start with `(`, `[` or `{`, or the last statement ends in a `return`.
569
+ * - In Scala 2: Only `{` is treated as continuing, irrespective of indentation,
570
+ * but not if it follows a `}`.
571
+ * - In Scala 3: In addition, indented statements are treated as continuing, as long as
572
+ * they start with `(`, or `[`, or the last statement ends in a `return`.
574
573
* The Scala 2 rules apply under source `3.0-migration` or under `-no-indent`.
575
574
*/
576
575
inline def isContinuing =
577
- lastWidth < nextWidth
578
- && (openParensTokens.contains(token) || lastToken == RETURN )
576
+ ( token == LBRACE && lastToken != RBRACE
577
+ || lastWidth < nextWidth
578
+ && (token == LPAREN || token == LBRACKET || lastToken == RETURN )
579
+ && ! migrateTo3
580
+ && ! noindentSyntax
581
+ )
579
582
&& ! pastBlankLine
580
- && ! migrateTo3
581
- && ! noindentSyntax
582
583
583
584
currentRegion match
584
585
case r : Indented =>
0 commit comments