Skip to content

v0.3.0

Compare
Choose a tag to compare
@kubukoz kubukoz released this 11 May 09:02
25a7182

Includes a new feature, prefixing a class with the name of the enclosing object - contributed by @mrobakowski in #27 🎉

Given this code:

object A {
  case class B(s: String)
}

A.B("ss")

before the change we would be seeing B(s = ss), now it will be A.B(s = ss). Note that the name of the object is not prefixed if it's a package object, and classes nested in other classes are still not influenced by the plugin.

This works for Scala 3 enums as well:

enum Foo:
  case Bar
  case Baz(s: String)

// outputs Foo.Baz(s = hello)
@main def demo = println(Foo.Baz("hello"))

This behavior is not up to configuration, and will likely increase verbosity of your toString calls - if you don't want that to be the case, it is suggested to implement toString on your own.