case class Newlines(source: SourceHints = Newlines.classic, avoidInResultType: Boolean = false, beforeTypeBounds: SourceHints = Newlines.classic, neverBeforeJsNative: Boolean = false, sometimesBeforeColonInMethodReturnType: Boolean = true, beforeOpenParenDefnSite: Option[BeforeOpenParen] = None, beforeOpenParenCallSite: Option[BeforeOpenParen] = None, penalizeSingleSelectMultiArgList: Boolean = true, alwaysBeforeCurlyBraceLambdaParams: Boolean = false, beforeCurlyLambdaParams: BeforeCurlyLambdaParams = BeforeCurlyLambdaParams.never, topLevelStatementBlankLines: Seq[TopStatBlanks] = Seq.empty, topLevelStatementsMinBreaks: Int = 1, topLevelStatements: Seq[BeforeAfter] = Seq.empty, beforeTemplateBodyIfBreakInParentCtors: Boolean = false, topLevelBodyIfMinStatements: Seq[BeforeAfter] = Seq.empty, topLevelBodyMinStatements: Int = 2, afterCurlyLambdaParams: AfterCurlyLambdaParams = AfterCurlyLambdaParams.never, implicitParamListModifierForce: Seq[BeforeAfter] = Seq.empty, implicitParamListModifierPrefer: Option[BeforeAfter] = None, alwaysBeforeElseAfterCurlyIf: Boolean = false, forceBeforeMultilineAssign: Option[ForceBeforeMultilineAssign] = None, alwaysBeforeMultilineDef: Boolean = false, beforeMultiline: Option[SourceHints] = None, beforeMultilineDef: Option[SourceHints] = None, selectChains: Option[SourceHints] = None, afterInfix: Option[AfterInfix] = None, afterInfixBreakOnNested: Boolean = false, afterInfixMaxCountPerExprForSome: Int = 10, afterInfixMaxCountPerFile: Int = 500, avoidForSimpleOverflow: Seq[AvoidForSimpleOverflow] = Seq.empty, avoidAfterYield: Boolean = true) extends Product with Serializable
- source
Controls how line breaks in the input source are handled If
classic(default), the old mixed behaviour will be used Ifkeep, try to keep source newlines Iffold, ignore source and try to remove line breaks Ifunfold, ignore source and try to break lines- neverBeforeJsNative
If true, a newline will never be placed in front of js.native.
- sometimesBeforeColonInMethodReturnType
If true, scalafmt may choose to put a newline before colon : at defs.
- penalizeSingleSelectMultiArgList
If true, adds a penalty to newlines before a dot starting a select chain of length one and argument list. The penalty matches the number of arguments to the select chain application.
// If true, favor logger.elem(a, b, c) // instead of logger .elem(a, b, c) // penalty is proportional to argument count, example: logger.elem(a, b, c) // penalty 2 logger.elem(a, b, c, d) // penalty 3, etc.
If false, matches pre-v0.5 behavior. Note. this option may be removed in a future release.
- beforeCurlyLambdaParams
- if Never, tries to use a space between the opening curly brace and the list of parameters of anonymous functions, and some partial functions (those with a single case clause and no conditions)
- if MultilineWithCaseOnly, forces a newline in partial functions (see above) which can't be formatted on a single line
- if Always, forces a newline in lambda and partial functions. For example:
something.map { n => consume(n) }- topLevelStatementBlankLines
Controls blank line before and/or after a top-level statement.
- afterCurlyLambdaParams
If
never(default), it will remove any extra lines below curly lambdassomething.map { x => f(x) }will become
something.map { x => f(x) }If
always, it will always add one empty line (opposite ofnever). Ifpreserve, and there isn't an empty line, it will keep it as it is. If there is one or more empty lines, it will place a single empty line. Ifsquash, it will try to squash lambda body in one line:xs.map { x => x + 1 }will become
xs.map { x => x + 1 }- alwaysBeforeElseAfterCurlyIf
if true, add a new line between the end of a curly if and the following else. For example if(someCond) { // ... } else //...
- beforeMultilineDef
If unfold (or true), add a newline before the body of a multiline def without curly braces. See #1126 for discussion. For example,
// newlines.beforeMultilineDef = fold def foo(bar: Bar): Foo = bar .flatMap(f) .map(g) // newlines.beforeMultilineDef = unfold def foo(bar: Bar): Foo = bar .flatMap(f) .map(g)
- afterInfix
Controls how line breaks around operations are handled If
keep(default for source=classic,keep), preserve existing Ifsome(default for source=fold), break after some infix ops Ifmany(default for source=unfold), break after many infix ops- afterInfixBreakOnNested
Force breaks around nested (enclosed in parentheses) expressions
- afterInfixMaxCountPerExprForSome
Switch to
manyfor a given expression (possibly nested) if the number of operations in that expression exceeds this value ANDafterInfixhad been set tosome.- afterInfixMaxCountPerFile
Switch to
keepfor a given file if the total number of infix operations in that file exceeds this value- avoidForSimpleOverflow
- punct: don't force break if overflow is only due to trailing punctuation
- tooLong: don't force break if overflow is due to tokens which are too long and would likely overflow even after a break
- avoidAfterYield
If false (legacy behavior), inserts unconditional line break after
yieldif the yield body doesn't fit on a single line. For example,// newlines.avoidAfterYield = true (default) for (a <- as) yield Future { ... } // newlines.avoidAfterYield = false (default before v2). for (a <- as) yield Future { ... }
- Alphabetic
- By Inheritance
- Newlines
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Newlines(source: SourceHints = Newlines.classic, avoidInResultType: Boolean = false, beforeTypeBounds: SourceHints = Newlines.classic, neverBeforeJsNative: Boolean = false, sometimesBeforeColonInMethodReturnType: Boolean = true, beforeOpenParenDefnSite: Option[BeforeOpenParen] = None, beforeOpenParenCallSite: Option[BeforeOpenParen] = None, penalizeSingleSelectMultiArgList: Boolean = true, alwaysBeforeCurlyBraceLambdaParams: Boolean = false, beforeCurlyLambdaParams: BeforeCurlyLambdaParams = BeforeCurlyLambdaParams.never, topLevelStatementBlankLines: Seq[TopStatBlanks] = Seq.empty, topLevelStatementsMinBreaks: Int = 1, topLevelStatements: Seq[BeforeAfter] = Seq.empty, beforeTemplateBodyIfBreakInParentCtors: Boolean = false, topLevelBodyIfMinStatements: Seq[BeforeAfter] = Seq.empty, topLevelBodyMinStatements: Int = 2, afterCurlyLambdaParams: AfterCurlyLambdaParams = AfterCurlyLambdaParams.never, implicitParamListModifierForce: Seq[BeforeAfter] = Seq.empty, implicitParamListModifierPrefer: Option[BeforeAfter] = None, alwaysBeforeElseAfterCurlyIf: Boolean = false, forceBeforeMultilineAssign: Option[ForceBeforeMultilineAssign] = None, alwaysBeforeMultilineDef: Boolean = false, beforeMultiline: Option[SourceHints] = None, beforeMultilineDef: Option[SourceHints] = None, selectChains: Option[SourceHints] = None, afterInfix: Option[AfterInfix] = None, afterInfixBreakOnNested: Boolean = false, afterInfixMaxCountPerExprForSome: Int = 10, afterInfixMaxCountPerFile: Int = 500, avoidForSimpleOverflow: Seq[AvoidForSimpleOverflow] = Seq.empty, avoidAfterYield: Boolean = true)
- source
Controls how line breaks in the input source are handled If
classic(default), the old mixed behaviour will be used Ifkeep, try to keep source newlines Iffold, ignore source and try to remove line breaks Ifunfold, ignore source and try to break lines- neverBeforeJsNative
If true, a newline will never be placed in front of js.native.
- sometimesBeforeColonInMethodReturnType
If true, scalafmt may choose to put a newline before colon : at defs.
- penalizeSingleSelectMultiArgList
If true, adds a penalty to newlines before a dot starting a select chain of length one and argument list. The penalty matches the number of arguments to the select chain application.
// If true, favor logger.elem(a, b, c) // instead of logger .elem(a, b, c) // penalty is proportional to argument count, example: logger.elem(a, b, c) // penalty 2 logger.elem(a, b, c, d) // penalty 3, etc.
If false, matches pre-v0.5 behavior. Note. this option may be removed in a future release.
- beforeCurlyLambdaParams
- if Never, tries to use a space between the opening curly brace and the list of parameters of anonymous functions, and some partial functions (those with a single case clause and no conditions)
- if MultilineWithCaseOnly, forces a newline in partial functions (see above) which can't be formatted on a single line
- if Always, forces a newline in lambda and partial functions. For example:
something.map { n => consume(n) }- topLevelStatementBlankLines
Controls blank line before and/or after a top-level statement.
- afterCurlyLambdaParams
If
never(default), it will remove any extra lines below curly lambdassomething.map { x => f(x) }will become
something.map { x => f(x) }If
always, it will always add one empty line (opposite ofnever). Ifpreserve, and there isn't an empty line, it will keep it as it is. If there is one or more empty lines, it will place a single empty line. Ifsquash, it will try to squash lambda body in one line:xs.map { x => x + 1 }will become
xs.map { x => x + 1 }- alwaysBeforeElseAfterCurlyIf
if true, add a new line between the end of a curly if and the following else. For example if(someCond) { // ... } else //...
- beforeMultilineDef
If unfold (or true), add a newline before the body of a multiline def without curly braces. See #1126 for discussion. For example,
// newlines.beforeMultilineDef = fold def foo(bar: Bar): Foo = bar .flatMap(f) .map(g) // newlines.beforeMultilineDef = unfold def foo(bar: Bar): Foo = bar .flatMap(f) .map(g)
- afterInfix
Controls how line breaks around operations are handled If
keep(default for source=classic,keep), preserve existing Ifsome(default for source=fold), break after some infix ops Ifmany(default for source=unfold), break after many infix ops- afterInfixBreakOnNested
Force breaks around nested (enclosed in parentheses) expressions
- afterInfixMaxCountPerExprForSome
Switch to
manyfor a given expression (possibly nested) if the number of operations in that expression exceeds this value ANDafterInfixhad been set tosome.- afterInfixMaxCountPerFile
Switch to
keepfor a given file if the total number of infix operations in that file exceeds this value- avoidForSimpleOverflow
- punct: don't force break if overflow is only due to trailing punctuation
- tooLong: don't force break if overflow is due to tokens which are too long and would likely overflow even after a break
- avoidAfterYield
If false (legacy behavior), inserts unconditional line break after
yieldif the yield body doesn't fit on a single line. For example,// newlines.avoidAfterYield = true (default) for (a <- as) yield Future { ... } // newlines.avoidAfterYield = false (default before v2). for (a <- as) yield Future { ... }
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val afterCurlyLambdaParams: AfterCurlyLambdaParams
- val afterInfix: Option[AfterInfix]
- val afterInfixBreakOnNested: Boolean
- val afterInfixMaxCountPerExprForSome: Int
- val afterInfixMaxCountPerFile: Int
- lazy val alwaysBeforeCurlyLambdaParams: Boolean
- val alwaysBeforeElseAfterCurlyIf: Boolean
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val avoidAfterYield: Boolean
- val avoidForSimpleOverflow: Seq[AvoidForSimpleOverflow]
- lazy val avoidForSimpleOverflowPunct: Boolean
- lazy val avoidForSimpleOverflowSLC: Boolean
- lazy val avoidForSimpleOverflowTooLong: Boolean
- val avoidInResultType: Boolean
- val beforeCurlyLambdaParams: BeforeCurlyLambdaParams
- val beforeMultilineDef: Option[SourceHints]
- val beforeTemplateBodyIfBreakInParentCtors: Boolean
- val beforeTypeBounds: SourceHints
- val breakAfterInfix: AfterInfix
- def checkInfixConfig(infixCount: Int): Newlines
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- lazy val forceAfterImplicitParamListModifier: Boolean
- lazy val forceBeforeImplicitParamListModifier: Boolean
- lazy val forceBlankBeforeMultilineTopLevelStmt: Boolean
- val formatInfix: Boolean
- lazy val getBeforeMultiline: SourceHints
- def getBeforeOpenParenCallSite: Option[SourceHints]
- def getBeforeOpenParenDefnSite: Option[SourceHints]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- lazy val getSelectChains: SourceHints
- def getTopStatBlankLines(tree: Tree, numBreaks: Int, nest: Int): Option[NumBlanks]
- val implicitParamListModifierForce: Seq[BeforeAfter]
- val implicitParamListModifierPrefer: Option[BeforeAfter]
- def isBeforeOpenParenCallSite: Boolean
- def isBeforeOpenParenDefnSite: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val neverBeforeJsNative: Boolean
- lazy val notBeforeImplicitParamListModifier: Boolean
- lazy val notPreferAfterImplicitParamListModifier: Boolean
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val penalizeSingleSelectMultiArgList: Boolean
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- lazy val shouldForceBeforeMultilineAssign: ForceBeforeMultilineAssign
- val sometimesBeforeColonInMethodReturnType: Boolean
- val source: SourceHints
- def sourceIgnored: Boolean
- Annotations
- @inline()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val topLevelBodyIfMinStatements: Seq[BeforeAfter]
- val topLevelBodyMinStatements: Int
- val topLevelStatements: Seq[BeforeAfter]
- val topLevelStatementsMinBreaks: Int
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()