com.colofabrix.scala.dixtra

Members list

Type members

Classlikes

object Config

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Config.type
final case class Config(maxColumn: Int, overflow: OverflowConfig, braces: BraceConfig, selectorChain: SelectorChainConfig, body: BodyConfig, definitionSite: DefinitionSiteConfig, callSite: CallSiteConfig, alignment: AlignmentConfig, blankLines: BlankLinesConfig, housekeeping: HousekeepingConfig, paths: PathsConfig, compat213: Boolean)

Formatting configuration for the dixtra formatter.

Formatting configuration for the dixtra formatter.

Value parameters

alignment

What aligns with what.

blankLines

The blank lines at the edges of bodies, between alignment groups and before scaladoc.

body

The layout of the body after = and =>.

braces

Where the braces go, and the brace style of each construct.

callSite

The layout of the arguments of calls.

compat213

Whether the output must also be valid Scala 2.13.

definitionSite

The layout of the parameters of definitions: signatures.

housekeeping

The housekeeping of a whole file.

maxColumn

The maximum allowed line width before a construct is forced to break.

overflow

What happens to what goes past maxColumn.

paths

The files and directories to format.

selectorChain

When select chains break.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Dixtra

Public entry point for the Dixtra Scala 3 formatter.

Public entry point for the Dixtra Scala 3 formatter.

The formatter is a pure function from source text to formatted source text. It first collapses redundant whitespace, parses the result with Scalameta and renders the tree according to the style rules of Dixtra. Any construct not yet supported falls back to the safety net, which reproduces the source verbatim, so the tool never corrupts code.

As a final guarantee the output is re-parsed and compared with the original input: if the program structure or the comments differ, formatting fails with an UnsafeOutputError instead of returning corrupted code.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Dixtra.type
sealed abstract class FormatError(message: String) extends Exception

Base error type for the dixtra formatter.

Base error type for the dixtra formatter.

Attributes

Companion
object
Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
object FormatError

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class ParseError(message: String) extends FormatError

Raised when the source cannot be parsed as valid Scala 3.

Raised when the source cannot be parsed as valid Scala 3.

Attributes

Supertypes
class FormatError
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final class Scala2Error(message: String) extends FormatError

Raised when the source is Scala 2: it parses only with the Scala 2 dialect of its kind of file, or it uses a construct that Scala 3 dropped. Scala 2 is not formatted, and such a file is skipped rather than failed.

Raised when the source is Scala 2: it parses only with the Scala 2 dialect of its kind of file, or it uses a construct that Scala 3 dropped. Scala 2 is not formatted, and such a file is skipped rather than failed.

Attributes

Supertypes
class FormatError
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
object SourceDialect

The Scalameta dialect a whole source file is parsed with.

The Scalameta dialect a whole source file is parsed with.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class UnsafeOutputError(message: String) extends FormatError

Raised when the formatted output would not be equivalent to the input (a different program structure or lost comments). The input is never rewritten in that case: this signals a formatter bug, not a problem with the source.

Raised when the formatted output would not be equivalent to the input (a different program structure or lost comments). The input is never rewritten in that case: this signals a formatter bug, not a problem with the source.

Attributes

Supertypes
class FormatError
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all