Class/Object

org.scalafmt.internal

Split

Related Docs: object Split | package internal

Permalink

case class Split(modification: Modification, cost: Int, tag: SplitTag = SplitTag.Active, activeTag: SplitTag = SplitTag.Active, indents: Seq[Indent] = Seq.empty, policy: Policy = NoPolicy, optimalAt: Option[OptimalToken] = None)(implicit line: Line) extends Product with Serializable

A Split is the whitespace between two non-whitespace tokens.

Consider a split to be an edge in a search graph and FormatToken are the nodes.

NB: there's a historical inconsistency in how splits are sorted; when they are initially considered, cost is the primary factor (and hence, because of stable sort, earlier split with the same cost will take precedence). However, when a search state is added into the priority queue, preference is given to states with lower cost, further token and, unlike above, a LATER line defining the split.

A possible reason for the latter is to give those "secondary" splits a chance to move through the BestFirstSearch algorithm, as otherwise a sequence of primary splits might end up as the winning solution even if it exceeds the maxColumn margins, because a secondary split was deemed unlikely to win and moved to a backup priority queue.

modification

Is this a space, no space, newline or 2 newlines?

cost

How good is this output? Lower is better.

indents

Does this add indentation?

policy

How does this split affect other later splits?

line

For debugging, to retrace from which case in Router this split originates.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Split
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Split(modification: Modification, cost: Int, tag: SplitTag = SplitTag.Active, activeTag: SplitTag = SplitTag.Active, indents: Seq[Indent] = Seq.empty, policy: Policy = NoPolicy, optimalAt: Option[OptimalToken] = None)(implicit line: Line)

    Permalink

    modification

    Is this a space, no space, newline or 2 newlines?

    cost

    How good is this output? Lower is better.

    indents

    Does this add indentation?

    policy

    How does this split affect other later splits?

    line

    For debugging, to retrace from which case in Router this split originates.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def activateFor(tag: SplitTag): Split

    Permalink
  5. val activeTag: SplitTag

    Permalink
  6. def adapt(formatToken: FormatToken): Split

    Permalink
  7. def andThenPolicy(newPolicy: Policy): Split

    Permalink
  8. def andThenPolicyOpt(newPolicy: ⇒ Option[Policy]): Split

    Permalink
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. val cost: Int

    Permalink

    How good is this output? Lower is better.

  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. val indentation: String

    Permalink
  16. val indents: Seq[Indent]

    Permalink

    Does this add indentation?

  17. def isActive: Boolean

    Permalink
    Annotations
    @inline()
  18. def isIgnored: Boolean

    Permalink
    Annotations
    @inline()
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def length: Int

    Permalink
    Annotations
    @inline()
  21. implicit val line: Line

    Permalink

    For debugging, to retrace from which case in Router this split originates.

  22. val modification: Modification

    Permalink

    Is this a space, no space, newline or 2 newlines?

  23. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def notIf(flag: Boolean): Split

    Permalink
    Annotations
    @inline()
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. def onlyFor(tag: SplitTag, ignore: Boolean = false): Split

    Permalink
  28. def onlyIf(flag: Boolean): Split

    Permalink
  29. val optimalAt: Option[OptimalToken]

    Permalink
  30. def orElsePolicy(newPolicy: Policy): Split

    Permalink
  31. val policy: Policy

    Permalink

    How does this split affect other later splits?

  32. def switch(switchObject: AnyRef): Split

    Permalink
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  34. val tag: SplitTag

    Permalink
  35. def toString(): String

    Permalink
    Definition Classes
    Split → AnyRef → Any
  36. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. def withIndent(indent: ⇒ Indent): Split

    Permalink
  40. def withIndent(length: ⇒ Length, expire: ⇒ Token, when: ExpiresOn): Split

    Permalink
  41. def withIndentOpt(indent: ⇒ Option[Indent]): Split

    Permalink
  42. def withIndentOpt(length: ⇒ Length, expire: Option[Token], when: ExpiresOn): Split

    Permalink
  43. def withIndents(indents: Seq[Indent]): Split

    Permalink
  44. def withOptimalAt(optimalAt: ⇒ Option[OptimalToken]): Split

    Permalink
  45. def withOptimalToken(token: ⇒ Token, killOnFail: Boolean = false): Split

    Permalink
  46. def withOptimalTokenOpt(token: ⇒ Option[Token], killOnFail: Boolean = false): Split

    Permalink
  47. def withPenalty(penalty: Int): Split

    Permalink
  48. def withPolicy(newPolicy: ⇒ Policy, ignore: Boolean = false)(implicit line: Line): Split

    Permalink
  49. def withPolicyOpt(newPolicy: ⇒ Option[Policy])(implicit line: Line): Split

    Permalink
  50. def withSingleLine(expire: Token, exclude: ⇒ Set[Range] = Set.empty, killOnFail: Boolean = false)(implicit line: Line): Split

    Permalink
  51. def withSingleLineAndOptimal(expire: Token, optimal: Token, exclude: ⇒ Set[Range] = Set.empty, killOnFail: Boolean = false)(implicit line: Line): Split

    Permalink
  52. def withSingleLineNoOptimal(expire: Token, exclude: ⇒ Set[Range] = Set.empty)(implicit line: Line): Split

    Permalink
  53. def withSingleLineOpt(expire: Option[Token], exclude: ⇒ Set[Range] = Set.empty, killOnFail: Boolean = false)(implicit line: Line): Split

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped