A Scala compiler plugin that adds support for trailing commas.
Currently only a snapshot is available.
resolvers += Opts.resolver.sonatypeSnapshots
addCompilerPlugin("fail.sauce" %% "commas" % "0.1.1-SNAPSHOT")
Now you can leave trailing commas in your import selectors and argument lists.
import scala.collection.immutable.{ Seq, Set, List, }
val foo = List(
"A",
"B",
"C",
)
This is currently a proof of concept, for fun.
The plugin hijacks the parser phase and replaces it with a customized parser that allows trailing commas in some scenarios. The hijacking is done with a mixture of reflection and carefully overridden fields. Paul Phillips' fork of Scala provided the basis for the parser changes.