p

org.scalafmt

internal

package internal

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

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

    The decision made by Router.

    The decision made by Router.

    Used by Policy to enforce non-local formatting.

  2. sealed abstract class ExpiresOn extends AnyRef
  3. class FormatOps extends AnyRef

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

  4. case class FormatToken(left: Token, right: Token, meta: Meta) extends Product with Serializable

    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.

    meta

    Extra information about the token

  5. class FormatTokens extends IndexedSeq[FormatToken]
  6. class FormatWriter extends AnyRef

    Produces formatted output from sequence of splits.

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

    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
  9. sealed abstract class Modification extends AnyRef
  10. case class NewlineT(isDouble: Boolean = false, noIndent: Boolean = false, acceptSpace: Boolean = false, acceptNoSplit: Boolean = false) extends Modification with Product with Serializable

    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
  12. case class Policy(f: Pf, expire: Int, noDequeue: Boolean = false)(implicit line: Line) extends Product with Serializable

    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
  14. class PriorityQueue[T] extends AnyRef

    Minimal implementation of the PriorityQueue's functions needed.

    Minimal implementation of the PriorityQueue's functions needed.

    We use java.util.PriorityQueue to enable usage under GraalVM. The native-image compiler is unable to work with scala.collection.mutable.PriorityQueue currently.

    T

    the values inside the queue

  15. case class Provided(code: String) extends Modification with Product with Serializable
  16. class Router extends AnyRef

    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(state: State, reachedEOF: Boolean) extends Product with Serializable
  18. sealed abstract class Side extends AnyRef
  19. case class Split(modification: Modification, cost: Int, ignoreIf: Boolean = false, indents: Vector[Indent[Length]] = Vector.empty[Indent[Length]], policy: Policy = NoPolicy, optimalAt: Option[OptimalToken] = None)(implicit line: Line) extends Product with Serializable

    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?

    line

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

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

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

  21. sealed trait SyntacticGroup extends AnyRef

Value Members

  1. object BestFirstSearch
  2. object Constants
  3. object ExpiresOn
  4. object FormatToken extends Serializable
  5. object FormatTokens
  6. object FormatWriter
  7. object Length
  8. object Newline extends NewlineT
  9. object Newline2x extends NewlineT
  10. object Newline2xNoIndent extends NewlineT
  11. object NoIndentNewline extends NewlineT
  12. object NoSplit extends Modification with Product with Serializable
  13. object Policy extends Serializable
  14. object PolicySummary
  15. object Side
  16. object Space extends Modification
  17. object Split extends Serializable
  18. object State extends Serializable
  19. object SyntacticGroup
  20. object SyntacticGroupOps
  21. object TreeSyntacticGroup

Ungrouped