Home

Awesome

! NO LONGER MAINTAINED !

This plugin doesn't work with the latest versions of Light Table and Groovy. If anyone would like to take over maintenance, feel free to get in touch. Alternatively I'm happy to receive pull requests bringing the plugin up to date.

Groovy plugin for Light Table

This plugin aims to provide Groovy support for the Light Table IDE. At the moment it is quite rudementary. The short term plan is to grow it into a feasible groovy console/groovy shell alternative with some unique features enabled by the Light Table platform. A long term plan would be to slowly grow it into a feasible Groovy IDE alternative.

Installation / Getting started

Development/Contributing

If you wish to submit pull request. Just fork this repo and install the plugin by cloning the repo into your Light Table plugin directory.

  $ cd /path/to/config/LightTable/plugins && git clone git@github.com:rundis/LightTable-Groovy.git

To build the groovy bits a Gradle wrapper script is provided:

  $ ./gradlew build deploy

Check out the wiki for more details: Contributing

Requirements

Features/Usage

Syntax highlighting

Simple syntax highlighting is provided throught the use of CodeMirror groovy mode.

Evaluate Groovy on Demand

Values for all top level expressions are shown. In looping constructs a max of 10 values are displayed for any given line. Exceptions are also displayed. If there are any exceptions, any values recorded prior to the exception arising are also shown.

Bindings

Bindings are stored/cached per editor. This gives you a behavior resembling a repl, but with many limitations. Anything that is evaluated is run as a groovy script, so obviously the same restrictions apply.

def myVar = 4

println myVar // will crash if you evaluate each line separately (ie two separate evals)
myVar = 4

println myVar // will work fine when evaluating lines separately, because myVar will be stored in binding
def myDouble(x) {x*2} // evaluates and results in a closure stored in bindings

myDouble(2) // I can invoke it

myDouble.curry(4)() // Its a closure not a method !

If you wish to clear all bindings for an editor invoke the command Groovy: Clear bindings for current editor (you probably would want to assign your own keyboard shortcut for it !)

Gradle integration

You can connect the groovy plugin to a gradle project (its using the Gradle tooling API under the hood). Just use the command Add connection and select "Groovy" from the list. Then select the directory where your build.gradle file resides. NOTE Won't work on multiprojects

Once connected you can import and use classes available from the classpath of that project. 3rd party libraries are available without further ado, but for project internal classes you must explicitly compile your project. The plugin uses the runttime classpath available through your projects main sourceSet

Gradle task execution

When you have connected to a Gradle project you can invoke tasks (currently only one at a time).

Show dependency graph

You can view a dependency graph for your connected gradle project via the command Groovy: Show gradle dependencies. Each dependency configuration available in your project can be viewed. For multiprojects you also get an overview diagram + the ability to drill down to individual projects. Feature hightlight:

Enable logging

If you wish to enable debug logging from the groovy client. Add the following to your user.behaviors

  :editor.groovy [(:lt.plugins.groovy/client-enable-logging)]

Output is written to: $groovy-plugin-dir$/lt_groovy.log

Version history

License

GPLv3 license, same as Light Table. See LICENSE.md for the full text.