File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
scalafmt-core/shared/src/main/scala/org/scalafmt Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -701,19 +701,21 @@ class FormatOps(
701701 nlSinglelineSplit,
702702 )
703703
704+ def getNextOp : Option [Name ] =
705+ if (! isAfterOp) Some (app.op)
706+ else getInfixRhsAsInfix(app) match {
707+ case Some (ia) => Some (findLeftInfix(ia).op)
708+ case _ if app eq fullInfix => None
709+ case _ => findNextInfixInParent(app, fullInfix)
710+ }
711+
704712 val otherSplits = closeOpt.fold {
705713 val nlSplit = Split (nlMod, 1 + breakPenalty)
706714 Seq (nlSplit.withIndent(nlIndent).withPolicy(nlPolicy & delayedBreak))
707715 } { closeFt =>
708716 val noSingleLine = newStmtMod.isDefined || breakMany ||
709717 rightAsInfix.exists(10 < infixSequenceLength(_))
710- val nextOp =
711- if (! afterInfix.breakOnNested) None
712- else if (! isAfterOp) Some (app.op)
713- else getInfixRhsAsInfix(app) match {
714- case Some (ia) => Some (findLeftInfix(ia).op)
715- case _ => findNextInfixInParent(app, fullInfix)
716- }
718+ val nextOp = if (afterInfix.breakOnNested) getNextOp else None
717719 val endOfNextOp = nextOp.map(getLast)
718720 val breakAfterClose : Policy = endOfNextOp.map(breakAfterComment)
719721
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ object InfixApp {
1010 def precedence : Int = InfixApp .getPrecedence(tree.op.value)
1111
1212 def singleArg : Option [Tree ] = tree.arg match {
13- case Member .ArgClause (v :: Nil ) => Some (v )
14- case _ => None
13+ case x : Member .ArgClause => TreeOps .getSingleElement(x.values )
14+ case x => Some (x)
1515 }
1616
1717 def args : Seq [Tree ] = tree.arg match {
You can’t perform that action at this time.
0 commit comments