p

org.scalafmt

internal

package internal

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. case class ActualIndent(length: Int, expire: Token, expiresAt: ExpiresOn, reset: Boolean) extends Product with Serializable
  2. 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.

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

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

  5. 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

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

    Produces formatted output from sequence of splits.

  8. abstract class Indent extends AnyRef
  9. sealed abstract class Length extends AnyRef
  10. case class ModExt(mod: Modification, indents: Seq[Indent] = Seq.empty) extends Product with Serializable

    mod

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

    indents

    Does this add indentation?

  11. sealed abstract class Modification extends AnyRef
  12. case class NewlineT(isDouble: Boolean = false, noIndent: Boolean = false, alt: Option[ModExt] = None) 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.

    alt

    Is it ok to replace this newline with a NoSplit or Space (with an optional additional set of indents) if the newline will indent beyond the current column? For example, used by select chains in Router.

  13. case class OptimalToken(token: Token, killOnFail: Boolean = false) extends Product with Serializable
  14. abstract class Policy extends AnyRef

    The decision made by Router.

    The decision made by Router.

    Used by Policy to enforce non-local formatting.

  15. class PolicySummary extends AnyRef
  16. 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

  17. case class Provided(ft: FormatToken) extends Modification with Product with Serializable
  18. 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

  19. case class SearchResult(state: State, reachedEOF: Boolean) extends Product with Serializable
  20. sealed abstract class Side extends AnyRef
  21. case class Split(modExt: ModExt, cost: Int, neededTags: Set[SplitTag] = Set.empty, activeTags: Set[SplitTag] = Set.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.

    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.

    modExt

    whitespace and indents

    cost

    How good is this output? Lower is better.

    policy

    How does this split affect other later splits?

    line

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

  22. sealed abstract class SplitTag extends AnyRef
  23. final case class State(cost: Int, policy: PolicySummary, split: Split, depth: Int, prev: State, indentation: Int, pushes: Seq[ActualIndent], column: Int, allAltAreNL: Boolean, delayedPenalty: Int, formatOff: Boolean) extends Product with Serializable

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

  24. sealed trait SyntacticGroup extends AnyRef
  25. class TokenRange extends AnyRef
  26. final class TokenRanges extends AnyVal

Value Members

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

Ungrouped