Class/Object

org.scalafmt.config

OptIn

Related Docs: object OptIn | package config

Permalink

case class OptIn(configStyleArguments: Boolean = true, breaksInsideChains: Boolean = false, breakChainOnFirstMethodDot: Boolean = true, encloseClassicChains: Boolean = false, selfAnnotationNewline: Boolean = true, annotationNewlines: Boolean = true, forceBlankLineBeforeDocstring: Boolean = true, blankLineBeforeDocstring: Boolean = false) extends Product with Serializable

configStyleArguments

Call-sites where there is a newline after opening ( and newline before closing ). If true, preserves the newlines and keeps one line per argument.

breaksInsideChains

NB: failure unless newlines.source=classic If true, then the user can opt out of line breaks inside select chains.

// original
foo
  .map(_ + 1).map(_ + 1)
  .filter(_ > 2)
// if true
foo
  .map(_ + 1).map(_ + 1)
  .filter(_ > 2)
// if false
foo
  .map(_ + 1)
  .map(_ + 1)
  .filter(_ > 2)
breakChainOnFirstMethodDot

NB: ignored unless newlines.source=classic If true, keeps the line break before a dot if it already exists.

// original
foo
  .map(_ + 1)
  .filter( > 2)
// if true
foo
  .map(_ + 1)
  .filter( > 2)
// if false
foo.map(_ + 1).filter( > 2)
encloseClassicChains

NB: ignored unless newlines.source=classic. Controls what happens if a chain enclosed in parentheses is followed by additional selects. Those additional selects will be considered part of the enclosed chain if and only if this flag is false.

// original
(foo.map(_ + 1).map(_ + 1))
  .filter(_ > 2)
// if true
(foo.map(_ + 1).map(_ + 1))
  .filter(_ > 2)
// if false
(foo
  .map(_ + 1)
  .map(_ + 1))
  .filter(_ > 2)
selfAnnotationNewline

See https://github.com/scalameta/scalafmt/issues/938 If true, will force a line break before a self annotation if there was a line break there before.

annotationNewlines

  • if newlines.source is missing or keep:
    • if true, will keep existing line breaks around annotations
  • if newlines.source is fold:
    • if true, will break before the entity being annotated
    • will not force break between consecutive annotations
  • if newlines.source is unfold:
    • if true, will break between consecutive annotations
    • will always break before the entity being annotated
forceBlankLineBeforeDocstring

If true, always insert a blank line before docstrings, If false, preserves blank line only if one exists before. Example:

// before
object Foo {
  /** Docstring */
  def foo = 2
}
// after, if forceBlankLineBeforeDocstring=false
object Foo {
  /** Docstring */
  def foo = 2
}
// after, if forceBlankLineBeforeDocstring=true
object Foo {
  /** Docstring */
  def foo = 2
}
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OptIn
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OptIn(configStyleArguments: Boolean = true, breaksInsideChains: Boolean = false, breakChainOnFirstMethodDot: Boolean = true, encloseClassicChains: Boolean = false, selfAnnotationNewline: Boolean = true, annotationNewlines: Boolean = true, forceBlankLineBeforeDocstring: Boolean = true, blankLineBeforeDocstring: Boolean = false)

    Permalink

    configStyleArguments

    Call-sites where there is a newline after opening ( and newline before closing ). If true, preserves the newlines and keeps one line per argument.

    breaksInsideChains

    NB: failure unless newlines.source=classic If true, then the user can opt out of line breaks inside select chains.

    // original
    foo
      .map(_ + 1).map(_ + 1)
      .filter(_ > 2)
    // if true
    foo
      .map(_ + 1).map(_ + 1)
      .filter(_ > 2)
    // if false
    foo
      .map(_ + 1)
      .map(_ + 1)
      .filter(_ > 2)
    breakChainOnFirstMethodDot

    NB: ignored unless newlines.source=classic If true, keeps the line break before a dot if it already exists.

    // original
    foo
      .map(_ + 1)
      .filter( > 2)
    // if true
    foo
      .map(_ + 1)
      .filter( > 2)
    // if false
    foo.map(_ + 1).filter( > 2)
    encloseClassicChains

    NB: ignored unless newlines.source=classic. Controls what happens if a chain enclosed in parentheses is followed by additional selects. Those additional selects will be considered part of the enclosed chain if and only if this flag is false.

    // original
    (foo.map(_ + 1).map(_ + 1))
      .filter(_ > 2)
    // if true
    (foo.map(_ + 1).map(_ + 1))
      .filter(_ > 2)
    // if false
    (foo
      .map(_ + 1)
      .map(_ + 1))
      .filter(_ > 2)
    selfAnnotationNewline

    See https://github.com/scalameta/scalafmt/issues/938 If true, will force a line break before a self annotation if there was a line break there before.

    annotationNewlines

    • if newlines.source is missing or keep:
      • if true, will keep existing line breaks around annotations
    • if newlines.source is fold:
      • if true, will break before the entity being annotated
      • will not force break between consecutive annotations
    • if newlines.source is unfold:
      • if true, will break between consecutive annotations
      • will always break before the entity being annotated
    forceBlankLineBeforeDocstring

    If true, always insert a blank line before docstrings, If false, preserves blank line only if one exists before. Example:

    // before
    object Foo {
      /** Docstring */
      def foo = 2
    }
    // after, if forceBlankLineBeforeDocstring=false
    object Foo {
      /** Docstring */
      def foo = 2
    }
    // after, if forceBlankLineBeforeDocstring=true
    object Foo {
      /** Docstring */
      def foo = 2
    }

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val annotationNewlines: Boolean

    Permalink

    • if newlines.source is missing or keep:
      • if true, will keep existing line breaks around annotations
    • if newlines.source is fold:
      • if true, will break before the entity being annotated
      • will not force break between consecutive annotations
    • if newlines.source is unfold:
      • if true, will break between consecutive annotations
      • will always break before the entity being annotated
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val blankLineBeforeDocstring: Boolean

    Permalink
  7. val breakChainOnFirstMethodDot: Boolean

    Permalink

    NB: ignored unless newlines.source=classic If true, keeps the line break before a dot if it already exists.

    NB: ignored unless newlines.source=classic If true, keeps the line break before a dot if it already exists.

    // original
    foo
      .map(_ + 1)
      .filter( > 2)
    // if true
    foo
      .map(_ + 1)
      .filter( > 2)
    // if false
    foo.map(_ + 1).filter( > 2)
  8. val breaksInsideChains: Boolean

    Permalink

    NB: failure unless newlines.source=classic If true, then the user can opt out of line breaks inside select chains.

    NB: failure unless newlines.source=classic If true, then the user can opt out of line breaks inside select chains.

    // original
    foo
      .map(_ + 1).map(_ + 1)
      .filter(_ > 2)
    // if true
    foo
      .map(_ + 1).map(_ + 1)
      .filter(_ > 2)
    // if false
    foo
      .map(_ + 1)
      .map(_ + 1)
      .filter(_ > 2)
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. val configStyleArguments: Boolean

    Permalink

    Call-sites where there is a newline after opening ( and newline before closing ).

    Call-sites where there is a newline after opening ( and newline before closing ). If true, preserves the newlines and keeps one line per argument.

  11. val encloseClassicChains: Boolean

    Permalink

    NB: ignored unless newlines.source=classic.

    NB: ignored unless newlines.source=classic. Controls what happens if a chain enclosed in parentheses is followed by additional selects. Those additional selects will be considered part of the enclosed chain if and only if this flag is false.

    // original
    (foo.map(_ + 1).map(_ + 1))
      .filter(_ > 2)
    // if true
    (foo.map(_ + 1).map(_ + 1))
      .filter(_ > 2)
    // if false
    (foo
      .map(_ + 1)
      .map(_ + 1))
      .filter(_ > 2)
  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. val forceBlankLineBeforeDocstring: Boolean

    Permalink

    If true, always insert a blank line before docstrings, If false, preserves blank line only if one exists before.

    If true, always insert a blank line before docstrings, If false, preserves blank line only if one exists before. Example:

    // before
    object Foo {
      /** Docstring */
      def foo = 2
    }
    // after, if forceBlankLineBeforeDocstring=false
    object Foo {
      /** Docstring */
      def foo = 2
    }
    // after, if forceBlankLineBeforeDocstring=true
    object Foo {
      /** Docstring */
      def foo = 2
    }
  15. lazy val forceNewlineBeforeDocstringSummary: Boolean

    Permalink

    See https://github.com/scalameta/scalafmt/issues/1712

    See https://github.com/scalameta/scalafmt/issues/1712

    Setting behavior and name were mirrored. After deprecation and right naming we need to: if forceBlankLineBeforeDocstring (new name) has default value (true) fallback to blankLineBeforeDocstring (old config) which may be configured in .scalafmt.conf if forceBlankLineBeforeDocstring configured to non-default value don't look at the old name

  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. implicit val reader: ConfDecoder[OptIn]

    Permalink
  22. val selfAnnotationNewline: Boolean

    Permalink

    See https://github.com/scalameta/scalafmt/issues/938 If true, will force a line break before a self annotation if there was a line break there before.

  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  24. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped