This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Proposal: Discoverable Settings for Scalac plugins

No replies
Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
:: Copied from scala-IDE mailing list ::
Scalac Plugin expanded properties--------------------------------------------------I'd like to make a proposal for the scalac plugin API to provide options to IDE users of plugins.   Particularly rather than this API for scalac plugin options:
def processOptions(options: List[String], error: String => Unit) : Unitdef optionsHelp: Option[String]
I'd like to propose the following API:
def options:  List[Setting] // Where setting is from scala.tools.nsc.setting which is now private[nsc].def processOptions(error : String => Unit) : Unit
The idea here is that a plugin provides settings objects that can create help messages (which scalac can wrap by plugin name).   In terms of how processOptions works, I think ideally the plugin provides a set of Settings objects that could be mutable or immutable and these are transformed by input arguments and returned to the plugin for processOptions.   However, right now it seems the mutable approach might work better, as that's what's used everywhere.
I think this needs a bit more thought, but it could drastically improve an IDEs ability to create a configuration GUI screen for plugins.   Let me know what you think.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland