Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Groovy language is an excellent platform for creating domain specific languages (DSLs). A good DSL can make programs more concise and expressive as well as make programmers more productive. However, until now these DSLs were not directly supported by the Groovy editor. When DSLs are used heavily, standard IDE features like content assist, search, hovers, and navigation lose their value. For a while now, it has been possible to write an Eclipse plugin to extend Groovy-Eclipse, but this is a heavy-weight approach that requires specific knowledge of the Eclipse APIs. This is no longer necessary. Groovy-Eclipse now supports DSL descriptor (DSLD) files that makes your DSL fully understood by Groovy-Eclipse.

(NOT DONE YET!!!)

For For example, it is possible to create a simple DSLD script that adds support for a distances DSL.

With no DSLD in your workspace, the following code snippet will be underlined and have no hover information:
Image Added

But add the following code snippet to a DSLD and the hovers will go away, and appropriate documentation will be available through hovers:

Code Block

currentType( subType( Number ) ).accept {
    [ m: "meter",  yd: "yard",  cm: "centimerter",  mi: "mile",  km: "kilometer"].each {
      // for clarity, assume $url is set elsewhere
      property name:it.key, type:"Distance",
        doc: """A <code>${it.value}</code> from <a href="$url">$url</a>"""
    }
}

Then the code snippet from above looks like this:
Image Added

For an overview of the feature, see the blog post on DSL Support. For a complete description on how to create and use DSLDs, have a look at see the documentation for DSL Descriptors for Groovy-Eclipse.

...