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 ScalaFmtLogger

    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 trait ExpiresOn extends AnyRef

    Permalink
  4. case class FormatToken(left: Token, right: Token, between: Vector[Whitespace]) extends ScalaFmtLogger with 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 left non-whitespace token.

    between

    The whitespace tokens between left and right.

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

    Permalink
  6. sealed trait Length extends AnyRef

    Permalink
  7. sealed abstract class Modification extends AnyRef

    Permalink
  8. trait NewlineT extends Modification

    Permalink
  9. case class Num(n: Int) extends Length with Product with Serializable

    Permalink
  10. case class Policy(f: PartialFunction[Decision, Decision], 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.

  11. class PolicySummary extends ScalaFmtLogger

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

    Permalink
  13. class Router extends ScalaFmtLogger

    Permalink

    Assigns splits to format tokens.

  14. trait ScalaFmtLogger extends AnyRef

    Permalink

    Debugging utility.

  15. 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[Token] = 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.

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

    Permalink

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

  17. type TokenHash = Long

    Permalink

    For convenience when experimenting with different hashing strategies.

Value Members

  1. object BestFirstSearch extends ScalaFmtLogger

    Permalink
  2. object Debug extends ScalaFmtLogger

    Permalink

    (ugly) Utility to collect data about formatter.

    (ugly) Utility to collect data about formatter.

    Only used during development.

  3. object FormatToken extends ScalaFmtLogger with Serializable

    Permalink
  4. object Left extends ExpiresOn with Product with Serializable

    Permalink
  5. object Newline extends Modification with NewlineT with Product with Serializable

    Permalink
  6. object Newline2x extends Modification with NewlineT with Product with Serializable

    Permalink
  7. object Newline2xNoIndent extends Modification with NewlineT with Product with Serializable

    Permalink
  8. object NoIndentNewline extends Modification with NewlineT with Product with Serializable

    Permalink
  9. val NoPolicy: Policy

    Permalink
  10. object NoSplit extends Modification with Product with Serializable

    Permalink
  11. object Policy extends Serializable

    Permalink
  12. object PolicySummary

    Permalink
  13. object Right extends ExpiresOn with Product with Serializable

    Permalink
  14. object Space extends Modification with Product with Serializable

    Permalink
  15. object State extends ScalaFmtLogger with Serializable

    Permalink
  16. object StateColumn extends Length with Product with Serializable

    Permalink
  17. def childOf(tok: Token, tree: Tree, owners: Map[TokenHash, Tree]): Boolean

    Permalink
  18. final def childOf(child: Tree, tree: Tree): Boolean

    Permalink
    Annotations
    @tailrec()
  19. def hash(token: Token): TokenHash

    Permalink

    Custom hash code for token.

    Custom hash code for token.

    The default hashCode is slow because it prevents conflicts between tokens from different source files. We only care about getting a unique identifier for the token inside this source file.

    The hash code works like this this: Top 8 bits go to privateTag, a unique identifier for the tokens class. Next 28 bits go to the tokens **start** offset byte. Final 28 bits go to the tokens **end** offset byte.

    The only chance for collision is if two empty length tokens with the same type lie next to each other. @xeno-by said this should not happen.

    Annotations
    @inline()
  20. final def parents(tree: Tree, accum: Seq[Tree] = Seq.empty[Tree]): Seq[Tree]

    Permalink
    Annotations
    @tailrec()

Inherited from AnyRef

Inherited from Any

Ungrouped