- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Proposal: Discoverable Settings for Scalac plugins
Wed, 2010-12-15, 20:17
:: 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.
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.