A compiler plugin to add support for trailing commas in Scala 2.11
Scala
Latest commit fac4abc Jun 28, 2016 @andyscott andyscott committed with raulraja Move to 47deg (#1)
Permalink
Failed to load latest commit information.
misc
project
src
.gitignore
COPYING
README.md
build.sbt
version.sbt

README.md

Commas

A Scala compiler plugin that adds support for trailing commas.

Usage

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",
)

Why?

This is currently a proof of concept, for fun.

How?

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.

License

See COPYING and also: