Package

org.scalafmt

internal

Permalink

package internal

Visibility
  1. Public
  2. All

Type Members

  1. case class ActualIndent(length: Int, expire: Token, expiresAt: ExpiresOn) extends Product with Serializable

    Permalink
  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, meta: Meta) 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.

    meta

    Extra information about the token

  6. class FormatTokens extends IndexedSeq[FormatToken]

    Permalink
  7. class FormatWriter extends AnyRef

    Permalink

    Produces formatted output from sequence of splits.

  8. abstract class Indent extends AnyRef

    Permalink
  9. sealed abstract class Length extends AnyRef

    Permalink
  10. sealed abstract class Modification extends AnyRef

    Permalink
  11. 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.

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

    Permalink
  13. case class Policy(f: Pf, expire: Int, noDequeue: 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.

  14. class PolicySummary extends AnyRef

    Permalink
  15. class PriorityQueue[T] extends AnyRef

    Permalink

    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

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

    Permalink
  17. 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

  18. case class SearchResult(state: State, reachedEOF: Boolean) extends Product with Serializable

    Permalink
  19. sealed abstract class Side extends AnyRef

    Permalink
  20. 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

    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.

    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.

  21. sealed abstract class SplitTag extends AnyRef

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

    Permalink

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

  23. sealed trait SyntacticGroup extends AnyRef

    Permalink

Value Members

  1. object BestFirstSearch

    Permalink
  2. object Constants

    Permalink
  3. object ExpiresOn

    Permalink
  4. object FormatToken extends Serializable

    Permalink
  5. object FormatTokens

    Permalink
  6. object FormatWriter

    Permalink
  7. object Indent

    Permalink
  8. object Length

    Permalink
  9. object Newline extends NewlineT

    Permalink
  10. object Newline2x extends NewlineT

    Permalink
  11. object Newline2xNoIndent extends NewlineT

    Permalink
  12. object NoIndentNewline extends NewlineT

    Permalink
  13. object NoSplit extends Modification with Product with Serializable

    Permalink
  14. object Policy extends Serializable

    Permalink
  15. object PolicySummary

    Permalink
  16. object Side

    Permalink
  17. object Space extends Modification

    Permalink
  18. object Split extends Serializable

    Permalink
  19. object SplitTag

    Permalink
  20. object State extends Serializable

    Permalink
  21. object SyntacticGroup

    Permalink
  22. object SyntacticGroupOps

    Permalink
  23. object TreeSyntacticGroup

    Permalink

Ungrouped