p

org.scalafmt

config

package config

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. config
  2. ScalafmtConfDecoders
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class Align(allowOverflow: Boolean = false, multiline: Boolean = false, stripMargin: Boolean = true, closeParenSite: Boolean = false, openBracketCallSite: Option[Boolean] = None, openParenCallSite: Boolean = false, openParenCtrlSite: Boolean = false, openBracketDefnSite: Option[Boolean] = None, openParenDefnSite: Boolean = false, openParenTupleSite: Option[Boolean] = None, beforeOpenParenDefnSite: Boolean = false, beforeOpenParenCallSite: Boolean = false, inInterpolation: Boolean = false, tokens: Seq[AlignToken] = Seq(AlignToken.caseArrow), arrowEnumeratorGenerator: Boolean = false, tokenCategory: Map[String, String] = Map(), treeCategory: Map[String, String] = ...) extends Product with Serializable

    stripMargin

    If set, indent lines with a strip-margin character in a multiline string constant relative to the opening quotes (or the strip-margin character if present) on the first line; otherwise, indent relative to the beginning of the first line, as usual.

    openParenCallSite

    If true AND bin-packing is true, then call-site arguments won't be aligned by the opening parenthesis. For example, this output will be disallowed

    function1(a,
              b,
              c)
    openParenCtrlSite

    If true, aligns by ( in if/while/for. If false, indents by continuation indent at call site.

    openParenDefnSite

    Same as openParenCallSite, except definition site.

    tokens

    The tokens to vertically align by. The "owner" is the scala.meta.Tree.getClass.getName of the deepest tree node that "owns" the token to align by.

    • Examples:
    align.tokens = ["="] // align = owned by any tree node (not recommended)
    
    align.tokens = [
      { code = "=", owner = "Param" } // align = when owned by parameter tree nodes
    ]
    • Pro tip. if you use for example
    preset = defaultWithAlign

    to add one extra token (for example "|>") to align by, write

    align.tokens."+" = [ "|> ]
    • NOTE. Adding more alignment tokens may potentially decrease the vertical alignment in formatted output. Customize at your own risk, I recommend you try and stick to the default settings.
    arrowEnumeratorGenerator

    If true, aligns by <- in for comprehensions.

    tokenCategory

    Customize which token kinds can align together. By default, only tokens with the same Token.productPrefix align. For example, to align = and <-, set the values to:

    Map("Equals" -> "Assign", "LeftArrow" -> "Assign")

    Note: Requires mixedTokens to be true.

    treeCategory

    Customize which tree kinds can align together. By default, only trees with the same Tree.productPrefix align. For example, to align Defn.Val and Defn.Var, set the values to:

    Map("Defn.Var" -> "Assign", "Defn.Val" -> "Assign")

    Note. Requires mixedOwners to be true.

  2. case class AlignToken(code: String, owner: String = null, owners: Seq[Owner] = Seq.empty) extends Product with Serializable

    Configuration option for aligning tokens.

    Configuration option for aligning tokens.

    code

    string literal value of the token to align by.

    owners

    array of owner specs.

  3. case class BinPack(unsafeCallSite: Unsafe = BinPack.Unsafe.Never, unsafeDefnSite: Unsafe = BinPack.Unsafe.Never, bracketCallSite: Option[Unsafe] = None, bracketDefnSite: Option[Unsafe] = None, indentCallSiteOnce: Boolean = false, indentCallSiteSingleArg: Boolean = true, parentConstructors: ParentCtors = BinPack.ParentCtors.source, literalArgumentLists: Boolean = true, literalsIncludeSimpleExpr: Boolean = false, literalsSingleLine: Boolean = false, literalsMinArgCount: Int = 5, literalsInclude: Seq[String] = Seq(".*"), literalsExclude: Seq[String] = Seq("String", "Term.Name")) extends Product with Serializable

    unsafeCallSite

    DO NOT USE! This option is buggy for complicated expressions. The only reason this option exists is to support the literalArgumentLists option, which enables callSite only for simple expressions. If true, will fit as many arguments on each line, only breaking at commas. If false, a function call's arguments will either be all on the same line or will have one line each.

    unsafeDefnSite

    Same as unsafeCallSite, except for definition site.

    parentConstructors

    Parent constructors are C and D in "class A extends B with C and D". If "Always", scalafmt will fit as many parent constructors on a single line. If "Never", each parent constructor gets its own line.

    literalArgumentLists

    If true, automatically sets the style to bin-pack for argument lists that only consist of literals.

    literalsMinArgCount

    Argument list must be longer than this setting to be eligible for literalArgumentLists.

    literalsInclude

    Regexes for literal type names. For example, "Int" or "Byte".

    literalsExclude

    Regexes for literal to exclude from literalArgumentLists.

  4. sealed abstract class Case extends AnyRef
  5. case class Comments(wrap: Wrap = Comments.Wrap.no, wrapSingleLineMlcAsSlc: Boolean = false, wrapStandaloneSlcAsSlc: Boolean = false) extends Product with Serializable

    wrap

    defines whether to wrap comments; the comment to be wrapped may not contain nested comments.

    • no: do not wrap
    • trailing: wrap the last comment on a line (line break after)
    • standalone: wrap standalone comments (line break both before and after the comment)
    wrapStandaloneSlcAsSlc

    if wrap is enabled, wrap standalone single-line comments (//) using the same type, rather than multi-line comments (/* ... */); it won't be applied to trailing comments as indentation would be inconsistent.

  6. case class DanglingParentheses(callSite: Boolean, defnSite: Boolean, ctrlSite: Boolean = true, tupleSite: Option[Boolean] = None, exclude: Option[List[Exclude]] = None) extends Product with Serializable
  7. case class Docstrings(oneline: Oneline = Docstrings.Oneline.keep, removeEmpty: Boolean = false, wrap: Wrap = Docstrings.Wrap.yes, wrapMaxColumn: Option[Int] = None, forceBlankLineBefore: Option[Boolean] = None, blankFirstLine: BlankFirstLine = Docstrings.BlankFirstLine.no, style: Style = Docstrings.SpaceAsterisk) extends Product with Serializable

    oneline

    • if fold, try to fold short docstrings into a single line
    • if unfold, unfold a single-line docstring into multiple lines
    • if keep, preserve the current formatting
    wrap

    if yes, allow reformatting/rewrapping the contents of the docstring

    style

    • Asterisk: format intermediate lines with an asterisk below the first asterisk of the first line (aka JavaDoc)
    • SpaceAsterisk: format intermediate lines with a space and an asterisk, both below the two asterisks of the first line
    • AsteriskSpace: format intermediate lines with an asterisk and a space, both below the two asterisks of the first line
  8. case class FilterMatcher(include: Regex, exclude: Regex) extends Product with Serializable
  9. sealed abstract class FormatEvent extends AnyRef

    An event that happens while formatting a file.

  10. type FormatEventCb = (FormatEvent) ⇒ Unit
    Definition Classes
    ScalafmtConfDecoders
  11. sealed abstract class ImportSelectors extends AnyRef

    ADT representing import selectors settings, specifically pertaining to the handling when multiple names are imported from the same package.

    ADT representing import selectors settings, specifically pertaining to the handling when multiple names are imported from the same package.

    When org.scalafmt.config.ImportSelectors.noBinPack is selected, imports are organized such that each line contains a single name imported from the base package:

    // max columns     |
    import org.{
      Aaaa,
      Bbbb,
      C,
      D,
      Eeee
    }

    When org.scalafmt.config.ImportSelectors.binPack is selected, imports are organized such that each line contains as many names as will fit within the column limit:

    // max columns     |
    import org.{
      Aaaa, Bbbb, C, D,
      Eeee
    }

    When org.scalafmt.config.ImportSelectors.singleLine is selected, imports are organized such that all names for a single package are arranged on a single line:

    // max columns     |
    import org.{Aaaa, Bbbb, C, D, Eeee}
  12. case class IndentOperator(exemptScope: Option[Exempt] = None, topLevelOnly: Boolean = true, includeRegex: String = ".*", excludeRegex: String = "^(&&|\\|\\|)$") extends Product with Serializable

    exemptScope

    If topLevel, allows no indentation on infix operators in top-level functions only. For example,

    // top-level, flag doesn't apply
    a &&
    b
    // true
    function(
      a &&
        b
    )
    // false
    function(
      a &&
      b
    )
    includeRegex

    Regexp for which infix operators should indent by 2 spaces. For example, .*= produces this output

    a &&
    b
    
    a +=
      b
    excludeRegex

    Regexp for which infix operators should not indent by 2 spaces. For example, when includeRegex is .* and excludeRegex is &&

    a &&
    b
    
    a ||
      b
    
    a +=
      b
    See also

    For context: https://github.com/scala-js/scala-js/blob/master/CODINGSTYLE.md#long-expressions-with-binary-operators

  13. case class Indents(main: Int = 2, significant: Option[Int] = None, callSite: Int = 2, ctrlSite: Option[Int] = None, defnSite: Int = 4, caseSite: Int = 4, matchSite: Option[Int] = None, ctorSite: Option[Int] = None, extraBeforeOpenParenDefnSite: Int = 0, relativeToLhsLastLine: Seq[RelativeToLhs] = Nil, fewerBraces: FewerBraces = Indents.FewerBraces.never, extendSite: Int = 4, withSiteRelativeToExtends: Int = 0, commaSiteRelativeToExtends: Int = 2) extends Product with Serializable

    main

    the primary indentation used in the code

    significant

    the indentation used when optional braces are omitted

    callSite

    indentation around function calls, etc.

    defnSite

    indentation around class/def

    caseSite

    indentation for case values before arrow

    ctorSite

    indentation around class constructor parameters

    extendSite

    indentation before extends

    withSiteRelativeToExtends

    additional indentation before with

    commaSiteRelativeToExtends

    additional indentation before in the line after extends with a comma

  14. sealed abstract class LineEndings extends AnyRef
  15. case class Literals(long: Case = Case.Upper, float: Case = Case.Lower, double: Case = Case.Lower, hexDigits: Case = Case.Lower, hexPrefix: Case = Case.Lower, scientific: Case = Case.Lower) extends Product with Serializable
  16. type MetaParser = Parse[_ <: Tree]
  17. case class NamedDialect(name: String, dialect: Dialect) extends Product with Serializable
  18. 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, 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, forceBeforeAssign: ForceBeforeMultilineAssign = ForceBeforeMultilineAssign.never, 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, inInterpolation: InInterpolation = InInterpolation.allow, 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
    • If keep, try to keep source newlines
    • If fold, ignore source and try to remove line breaks
    • If unfold, 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 lambdas
    something.map { x =>
    
      f(x)
    }

    will become

    something.map { x =>
      f(x)
    }
    • If always, it will always add one empty line (opposite of never). If preserve, 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.
    • If squash, 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
    • If some (default for source=fold), break after some infix ops
    • If many (default for source=unfold), break after many infix ops
    afterInfixBreakOnNested

    Force breaks around nested (enclosed in parentheses) expressions

    afterInfixMaxCountPerExprForSome

    Switch to many for a given expression (possibly nested) if the number of operations in that expression exceeds this value AND afterInfix had been set to some.

    afterInfixMaxCountPerFile

    Switch to keep for 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 yield if 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 {
        ...
      }
  19. case class OptIn(configStyleArguments: Boolean = true, breaksInsideChains: Boolean = false, breakChainOnFirstMethodDot: Boolean = true, encloseClassicChains: Boolean = false, selfAnnotationNewline: Boolean = true, annotationNewlines: Boolean = true, forceBlankLineBeforeDocstring: Boolean = true) extends Product with Serializable

    configStyleArguments

    Call-sites where there is a newline after opening ( and newline before closing ). If true, preserves the newlines and keeps one line per argument.

    breaksInsideChains

    NB: failure unless newlines.source=classic If true, then the user can opt out of line breaks inside select chains.

    // original
    foo
      .map(_ + 1).map(_ + 1)
      .filter(_ > 2)
    // if true
    foo
      .map(_ + 1).map(_ + 1)
      .filter(_ > 2)
    // if false
    foo
      .map(_ + 1)
      .map(_ + 1)
      .filter(_ > 2)
    breakChainOnFirstMethodDot

    NB: ignored unless newlines.source=classic If true, keeps the line break before a dot if it already exists.

    // original
    foo
      .map(_ + 1)
      .filter( > 2)
    // if true
    foo
      .map(_ + 1)
      .filter( > 2)
    // if false
    foo.map(_ + 1).filter( > 2)
    encloseClassicChains

    NB: ignored unless newlines.source=classic. Controls what happens if a chain enclosed in parentheses is followed by additional selects. Those additional selects will be considered part of the enclosed chain if and only if this flag is false.

    // original
    (foo.map(_ + 1).map(_ + 1))
      .filter(_ > 2)
    // if true
    (foo.map(_ + 1).map(_ + 1))
      .filter(_ > 2)
    // if false
    (foo
      .map(_ + 1)
      .map(_ + 1))
      .filter(_ > 2)
    selfAnnotationNewline

    See https://github.com/scalameta/scalafmt/issues/938 If true, will force a line break before a self annotation if there was a line break there before.

    annotationNewlines

    • if newlines.source is missing or keep:
      • if true, will keep existing line breaks around annotations
    • if newlines.source is fold:
      • if true, will break before the entity being annotated
      • will not force break between consecutive annotations
    • if newlines.source is unfold:
      • if true, will break between consecutive annotations
      • will always break before the entity being annotated
    forceBlankLineBeforeDocstring

    If true, always insert a blank line before docstrings, If false, preserves blank line only if one exists before. Example:

    // before
    object Foo {
      /** Docstring */
      def foo = 2
    }
    // after, if forceBlankLineBeforeDocstring=false
    object Foo {
      /** Docstring */
      def foo = 2
    }
    // after, if forceBlankLineBeforeDocstring=true
    object Foo {
    
      /** Docstring */
      def foo = 2
    }
  20. case class Pattern(includeFilters: Seq[String], excludeFilters: Seq[String]) extends Product with Serializable
  21. case class ProjectFiles(git: Boolean = false, layout: Option[Layout] = None, includePaths: Seq[String] = ProjectFiles.defaultIncludePaths, excludePaths: Seq[String] = Nil, includeFilters: Seq[String] = Nil, excludeFilters: Seq[String] = Nil) extends Product with Serializable
  22. case class RedundantBracesSettings(defnBodies: DefnBodies = ..., includeUnitMethods: Boolean = true, maxBreaks: Int = 100, stringInterpolation: Boolean = false, parensForOneLineApply: Boolean = true, generalExpressions: Boolean = true, ifElseExpressions: Boolean = false) extends Product with Serializable
  23. case class RedundantParensSettings(infixSide: Option[InfixSide] = None) extends Product with Serializable
  24. case class RewriteScala3Settings(convertToNewSyntax: Boolean = false, removeOptionalBraces: RemoveOptionalBraces = RemoveOptionalBraces.no, countEndMarkerLines: EndMarkerLines = ..., removeEndMarkerMaxLines: Int = 0, insertEndMarkerMinLines: Int = 0) extends Product with Serializable
  25. case class RewriteSettings(rules: Seq[Rewrite] = Nil, scala3: RewriteScala3Settings = RewriteScala3Settings.default, insertBraces: InsertBraces = RewriteSettings.InsertBraces(), redundantBraces: RedundantBracesSettings = RedundantBracesSettings.default, redundantParens: RedundantParensSettings = RedundantParensSettings.default, sortModifiers: SortSettings = SortSettings.default, imports: Settings = Imports.Settings(), preferCurlyFors: Settings = PreferCurlyFors.Settings(), trailingCommas: TrailingCommas = TrailingCommas(), allowInfixPlaceholderArg: Boolean = true, neverInfix: Pattern = Pattern.neverInfix) extends Product with Serializable
  26. trait ScalafmtConfDecoders extends AnyRef
  27. case class ScalafmtConfig(version: String = org.scalafmt.Versions.stable, maxColumn: Int = 80, docstrings: Docstrings = Docstrings(), comments: Comments = Comments(), optIn: OptIn = OptIn(), binPack: BinPack = BinPack(), indent: Indents = Indents(), align: Align = Align(), spaces: Spaces = Spaces(), literals: Literals = Literals(), lineEndings: LineEndings = LineEndings.unix, rewriteTokens: Map[String, String] = Map.empty[String, String], rewrite: RewriteSettings = RewriteSettings.default, indentOperator: IndentOperator = IndentOperator(), newlines: Newlines = Newlines(), runner: ScalafmtRunner = ScalafmtRunner.default, indentYieldKeyword: Boolean = true, importSelectors: ImportSelectors = ImportSelectors.noBinPack, includeCurlyBraceInSelectChains: Boolean = true, includeNoParensInSelectChains: Boolean = false, assumeStandardLibraryStripMargin: Boolean = false, danglingParentheses: DanglingParentheses = DanglingParentheses.default, poorMansTrailingCommasInConfigStyle: Boolean = false, trailingCommas: Option[Style] = None, verticalMultiline: VerticalMultiline = VerticalMultiline(), verticalAlignMultilineOperators: Boolean = false, onTestFailure: String = "", encoding: Codec = "UTF-8", project: ProjectFiles = ProjectFiles(), fileOverride: Obj = Conf.Obj.empty, xmlLiterals: XmlLiterals = XmlLiterals()) extends Product with Serializable

    Configuration options for scalafmt.

    Configuration options for scalafmt.

    version

    The version of scalafmt to use for this project. Must match the currently running version of scalafmt.

    maxColumn

    Column limit, any formatting exceeding this field is penalized heavily.

    lineEndings

    • If LineEndings.unix, output will include only unix line endings
    • If LineEndings.windows, output will include only windows line endings
    • If LineEndings.preserve, output will include endings included in original file (windows if there was at least one windows line ending, unix if there was zero occurrences of windows line endings)
    rewriteTokens

    Map of tokens to rewrite. For example, Map("⇒" -> "=>") will rewrite unicode arrows to regular ascii arrows.

    indentYieldKeyword

    • If true, indents yield by two spaces
    for (i <- j)
      yield banana
    • If false, treats yield like else
    for (i <- j)
    yield banana
    importSelectors

    Controls formatting of import selectors with multiple names from the same package

    includeCurlyBraceInSelectChains

    NB: failure unless newlines.source=classic If true, includes curly brace applications in select chains/pipelines.

    // If true
    List(1)
      .map { x =>
        x + 2
      }
      .filter(_ > 2)
    // If false
    List(1).map { x =>
        x + 2
    }.filter(_ > 2)
    includeNoParensInSelectChains

    NB: ignored unless newlines.source=classic If true, includes applications without parens in select chains/pipelines.

    // If true
    List(1)
      .toIterator
      .buffered
      .map(_ + 2)
      .filter(_ > 2)
    // If false
    List(1).toIterator.buffered
      .map(_ + 2)
      .filter(_ > 2)
    assumeStandardLibraryStripMargin

    If true, the margin character | is treated as the new indentation in multiline strings ending with .stripMargin.

    danglingParentheses

    If true AND @binPackArguments is true AND @configStyleArguments is false, then this

    function(
        longerArg1,
        longerArg3)

    is formatted like this

    function(
        longerArg1,
        longerArg3
    )
  28. class ScalafmtConfigException extends Exception
  29. case class ScalafmtOptimizer(dequeueOnNewStatements: Boolean = true, escapeInPathologicalCases: Boolean = true, maxVisitsPerToken: Int = 10000, maxEscapes: Int = 16, maxDepth: Int = 100, acceptOptimalAtHints: Boolean = true, disableOptimizationsInsideSensitiveAreas: Boolean = true, pruneSlowStates: Boolean = true, recurseOnBlocks: Boolean = true, forceConfigStyleOnOffset: Int = 150, forceConfigStyleMinArgCount: Int = 2) extends Product with Serializable

    Configuration for scalafmt optimizations.

    Configuration for scalafmt optimizations.

    dequeueOnNewStatements

    Clear the search queue on new statements.

    escapeInPathologicalCases

    Use heuristics to escape when the search state grows out of bounds. An optimization that trades off optimal formatting output in order to complete in a reasonable time. Used as a last resort.

    maxVisitsPerToken

    Visit the same formatToken at most maxVisitsPerToken times.

    maxEscapes

    How often do we try to escape before giving up and use original formatting.

    maxDepth

    Maximum depth of recursion.

    acceptOptimalAtHints

    Whether to listen to optimalAt fields in Splits.

    disableOptimizationsInsideSensitiveAreas

    Do not optimize inside certain areas such as term apply.

    pruneSlowStates

    Eliminate solutions that move slower than other solutions.

    • If a solution reaches a point X first and other solution that reaches the same point later, the first solution is preferred if it can be verified to be always better (see org.scalafmt.internal.State.alwaysBetter).
    • Note. This affects the output positively because it breaks a tie between two equally expensive solutions by eliminating the slower one.
    • Example: solution 1 is preferred even though both solutions cost the same:
    // solution 1
    a + b +
    c + d
    // solution 2
    a +
    b + c + d
    recurseOnBlocks

    Recursively format { ... } blocks inside no optimization zones. By starting a new search queue, we can perform aggressive optimizations inside optimizations zones.

    forceConfigStyleOnOffset

    If negative number, does nothing. If n >= 0, then scalafmt will force "config style" on Term.Apply nodes IF it has more than forceConfigStyleMinArgCount arguments AND the non-whitespace byte offset between the opening parens and closing parens is greater than forceConfigStyleOnOffset. By forcing config style on such applications, the search space is greatly reduced.

  30. sealed class ScalafmtParser extends AnyRef
  31. case class ScalafmtRunner(debug: Boolean = false, eventCallback: (FormatEvent) ⇒ Unit = null, parser: ScalafmtParser = ScalafmtParser.Source, optimizer: ScalafmtOptimizer = ScalafmtOptimizer.default, maxStateVisits: Int = 1000000, dialect: NamedDialect = NamedDialect.default, dialectOverride: Obj = Conf.Obj.empty, ignoreWarnings: Boolean = false, fatalWarnings: Boolean = false) extends Product with Serializable

    A FormatRunner configures how formatting should behave.

    A FormatRunner configures how formatting should behave.

    debug

    Should we collect debugging statistics?

    eventCallback

    Listen to events that happens while formatting

    parser

    Are we formatting a scala.meta.{Source,Stat,Case,...}? For more details, see members of scala.meta.parsers.

  32. case class SortSettings(order: List[ModKey]) extends Product with Serializable
  33. case class Spaces(beforeContextBoundColon: BeforeContextBound = Spaces.BeforeContextBound.Never, afterTripleEquals: Boolean = false, inImportCurlyBraces: Boolean = false, inInterpolatedStringCurlyBraces: Boolean = false, inParentheses: Boolean = false, neverAroundInfixTypes: Seq[String] = Nil, afterKeywordBeforeParen: Boolean = true, inByNameTypes: Boolean = true, afterSymbolicDefs: Boolean = false) extends Product with Serializable

    beforeContextBoundColon

    formats [A: T] as [A : T]

    afterTripleEquals

    If true, formats ===( as === (

    inImportCurlyBraces

    • If true, formats
    import a.b.{ c, d}
    • If false, formats
    import a.b.{c, d}
    inInterpolatedStringCurlyBraces

    If true, formats

    s"${var1} ${var2.sub}"

    as

    s"${ var1 } ${ var2.sub }"
    inParentheses

    If true, formats foo(a, b) as foo( a, b ).

    neverAroundInfixTypes

    If ["##"] is specified as operator then formats

    Generic[Foo] ## Repr

    as

    Generic[Foo]##Repr
    afterKeywordBeforeParen

    if false, does not add a space between a keyword and a parenthesis. For example:

    if(a) println("HELLO!")
    while(a) println("HELLO!")
    inByNameTypes

    If false, removes space in by-name parameter:

    def foo(a: =>A)
    afterSymbolicDefs

    If true, adds a single space after an operator method. For example:

    def <=> [T](that: T): Boolean
  34. case class TrailingCommas(allowFolding: Boolean = true, style: Style = TrailingCommas.never) extends Product with Serializable
  35. case class VerticalMultiline(atDefnSite: Boolean = false, arityThreshold: Int = 100, newlineAfterOpenParen: Boolean = false) extends Product with Serializable

    Configuration related to multi-line formatting.

  36. case class XmlLiterals(assumeFormatted: Boolean = false) extends Product with Serializable

Value Members

  1. implicit lazy val codecReader: ConfDecoderEx[Codec]
    Definition Classes
    ScalafmtConfDecoders
  2. implicit lazy val eventReader: ConfDecoderEx[FormatEventCb]
    Definition Classes
    ScalafmtConfDecoders
  3. implicit lazy val parseReader: ConfCodecEx[MetaParser]
    Definition Classes
    ScalafmtConfDecoders
  4. object Align extends Serializable
  5. object AlignToken extends Serializable
  6. object BinPack extends Serializable
  7. object Case
  8. object Comments extends Serializable
  9. object Config
  10. object DanglingParentheses extends Serializable
  11. object Docstrings extends Serializable
  12. object FilterMatcher extends Serializable
  13. object FormatEvent
  14. object ImportSelectors
  15. object IndentOperator extends Serializable
  16. object Indents extends Serializable
  17. object LineEndings
  18. object Literals extends Serializable
  19. object NamedDialect extends Serializable
  20. object Newlines extends Serializable
  21. object OptIn extends Serializable
  22. object Pattern extends Serializable
  23. object Presets
  24. object ProjectFiles extends Serializable
  25. object ReaderUtil
  26. object RedundantBracesSettings extends Serializable
  27. object RedundantParensSettings extends Serializable
  28. object RewriteScala3Settings extends Serializable
  29. object RewriteSettings extends Serializable
  30. object ScalafmtConfDecoders extends ScalafmtConfDecoders
  31. object ScalafmtConfig extends Serializable
  32. object ScalafmtOptimizer extends Serializable
  33. object ScalafmtParser
  34. object ScalafmtRunner extends Serializable
  35. object SortSettings extends Serializable
  36. object Spaces extends Serializable
  37. object TrailingCommas extends Serializable
  38. object VerticalMultiline extends Serializable
  39. object XmlLiterals extends Serializable

Inherited from ScalafmtConfDecoders

Inherited from AnyRef

Inherited from Any

Ungrouped