Light-weight IDE extensibility for custom DSLs in Groovy
Domain specific languages (DSLs) are a great tool for solving certain kinds of problems. Many JVM languages, such as Groovy, make it easy to create DSLs. However, providing proper IDE support for these mini-languages is hard, especially for dynamically typed languages since type information is not provided by the compiler.
We have solved this problem inside of Groovy-Eclipse through the use of DSL descriptors (DSLDs). DSLDs are Groovy scripts that provide the IDE with a description of the enhanced semantics of a DSL so that standard IDE behavior can be augmented with semantic knowledge of the DSL.
Although Groovy-Eclipse exposes similar functionality through standard Eclipse extension points and a well-defined API, there are many benefits to this light-weight extensibility approach:
- DSLDs do not need to be stored in an Eclipse plugin. They can be stored in project sources, or in a user-library.
- Therefore, DSLDs can be more easily shared between developers than standard plugins.
- Creating a DSLD does not require any knowledge of Eclipse internals or APIs. However, an understanding of the target language and the DSL is required.
- DSLDs are real-time in that a change to a DSLD script is immediately reflected inside your project.
In this talk, we will start with some examples of DSLDs, showing how you can provide editing support for simple and complex DSLs. Then we will move on to the implementation, showing an overview of the implementation in Groovy-Eclipse.