Package

org.scalafmt

internal

Permalink

package internal

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. internal
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class BestFirstSearch extends AnyRef

    Permalink

    Implements best first search to find optimal formatting.

  2. case class Decision(formatToken: FormatToken, splits: Seq[Split]) extends Product with Serializable

    Permalink

    The decision made by Router.

    The decision made by Router.

    Used by Policy to enforce non-local formatting.

  3. sealed abstract class ExpiresOn extends AnyRef

    Permalink
  4. class FormatOps extends AnyRef

    Permalink

    Helper functions for generating splits/policies for a given tree.

  5. case class FormatToken(left: Token, right: Token, between: Vector[Token]) extends Product with Serializable

    Permalink

    Two adjacent non-whitespace tokens.

    Two adjacent non-whitespace tokens.

    Consider a FormatToken as a node in a search graph and Split are the edges. The format tokens remain unchanged after formatting, while the splits are changed.

    left

    The left non-whitespace token.

    right

    The right non-whitespace token.

    between

    The whitespace tokens between left and right.

  6. class FormatWriter extends AnyRef

    Permalink

    Produces formatted output from sequence of splits.

  7. case class Indent[T <: Length](length: T, expire: Token, expiresAt: ExpiresOn) extends Product with Serializable

    Permalink

    One layer of indentation, created by an opening (, {, etc.

    One layer of indentation, created by an opening (, {, etc.

    Indent is parameterized by some Length to allow splits from Router to be memoized. If the length field was int, we would have to eagerly evaluate the indentation for state columns, which may be different depending on the formatting we choose.

    T

    Can be a known number Num (used in State) or unknown integer StateColumn (used in Split).

    length

    lengt of indentation, can be negative (in rare cases, with deeply nested terms with no newlines).

    expire

    Until which token does this indentation stay?

    expiresAt

    If Right, then expires when expire is curr.right, otherwise curr.left in BestFirstSearch.

  8. sealed abstract class Length extends AnyRef

    Permalink
  9. sealed abstract class Modification extends AnyRef

    Permalink
  10. case class NewlineT(isDouble: Boolean = false, noIndent: Boolean = false, acceptSpace: Boolean = false, acceptNoSplit: Boolean = false) extends Modification with Product with Serializable

    Permalink

    A split representing a newline.

    A split representing a newline.

    isDouble

    Insert a blank line?

    noIndent

    Should no indentation follow? For example in commented out code.

    acceptNoSplit

    Is it ok to replace this newline with a NoSplit if the newline will indent beyond the current column? For example, used by select chains in Router.

  11. case class OptimalToken(token: Token, killOnFail: Boolean = false) extends Product with Serializable

    Permalink
  12. case class Policy(f: PartialFunction[Decision, Decision], expire: Int, noDequeue: Boolean = false, isSingleLine: Boolean = false)(implicit line: Line) extends Product with Serializable

    Permalink

    The decision made by Router.

    The decision made by Router.

    Used by Policy to enforce non-local formatting.

    f

    is applied to every decision until expire

    expire

    The latest token offset.

  13. class PolicySummary extends AnyRef

    Permalink
  14. type PriorityQueue[T] = scala.collection.mutable.PriorityQueue[T]

    Permalink
  15. case class Provided(code: String) extends Modification with Product with Serializable

    Permalink
  16. class Router extends AnyRef

    Permalink

    Assigns splits to format tokens.

    Assigns splits to format tokens.

    NOTE(olafurpg). The pattern match in this file has gotten out of hand. It's difficult even for myself to keep track of what's going on in some cases, especially around applications and lambdas. I'm hoping to sunset this file along with BestFirstSearch in favor of https://github.com/scalameta/scalafmt/issues/917

  17. case class SearchResult(splits: Vector[Split], reachedEOF: Boolean) extends Product with Serializable

    Permalink
  18. sealed abstract class Side extends AnyRef

    Permalink
  19. case class Split(modification: Modification, cost: Int, ignoreIf: Boolean = false, indents: Vector[Indent[Length]] = Vector.empty[Indent[Length]], policy: Policy = NoPolicy, penalty: Boolean = false, optimalAt: Option[OptimalToken] = None)(implicit line: Line) extends Product with Serializable

    Permalink

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

    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.

    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?

    penalty

    Does this split overflow the column limit?

    line

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

  20. final case class State(cost: Int, policy: PolicySummary, splits: Vector[Split], indentation: Int, pushes: Vector[Indent[Num]], column: Int, formatOff: Boolean) extends Ordered[State] with Product with Serializable

    Permalink

    A partial formatting solution up to splits.length number of tokens.

  21. sealed trait SyntacticGroup extends AnyRef

    Permalink

Value Members

  1. object Constants

    Permalink
  2. object ExpiresOn

    Permalink
  3. object FormatToken extends Serializable

    Permalink
  4. object FormatWriter

    Permalink
  5. object Length

    Permalink
  6. object Newline extends NewlineT

    Permalink
  7. object Newline2x extends NewlineT

    Permalink
  8. object Newline2xNoIndent extends NewlineT

    Permalink
  9. object NoIndentNewline extends NewlineT

    Permalink
  10. object NoSplit extends Modification with Product with Serializable

    Permalink
  11. object Policy extends Serializable

    Permalink
  12. object PolicySummary

    Permalink
  13. object Side

    Permalink
  14. object Space extends Modification

    Permalink
  15. object State extends Serializable

    Permalink
  16. object SyntacticGroup

    Permalink
  17. object SyntacticGroupOps

    Permalink
  18. object TreeSyntacticGroup

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped