I am writing a Scala plugin for an editor I use that would highlight all unused code paths (could be unused defs
, vals
, classes
and implicits
), and give the user an option to yank them out of the .scala
file.
How can I do this? To simplify the problem, let's pretend we only have a single root level .scala
file with no external dependency on libraries or any other code files.
Ideally I would want this to be an SBT plugin that, given a single such Foo.scala
file, would spit out Foo_min.Scala
file with all unused code removed.
-Ywarn-unused
and-Ywarn-unused-import
as sbt options. – Lithograph