• Stars
    star
    25
  • Rank 924,977 (Top 19 %)
  • Language
    JavaScript
  • License
    Other
  • Created about 10 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Groovy plugin for Light Table

! 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

  • The plugin is available from the Light Table plugin manager under the name Groovy.
  • Check out the screencast

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 [email protected]: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

  • You need to have groovy installed and available in your PATH. I would recommend using GVM

Features/Usage

Syntax highlighting

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

Evaluate Groovy on Demand

  • ctrl/cmd-shift-enter evaluates all content in the current editor, prints any output to the console and shows results line by line.
  • ctrl/cmd-enter evaluates the selected text/current line, prints output to the console and shows results inline for selected line(s).

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).

  • Select command: Groovy: Select gradle task
  • A list of available tasks is shown. For multiprojects task selectors are shown in addition to the individual tasks available for each subproject
  • Select task (or task selector)
  • The task will be executed and progress shown in the status bar. If there is an error the stacktrace is logged to the console.

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:

  • Zoom in / out with mouse or keyboard
  • Pan (with mouse only currently)
  • View dependency graph per configuration (tab/button per config)
  • Overview diagram for multiproject (creates edges for any connection between projects regardless of configuration)
  • Any project node (configured as project(....) dependency in gradle) should be clickable.
  • Clicking on a project dep node should bring you to a detailed view of dependecies for that project
  • If you click the "header" of the diagram you should be taken back to the default view

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

  • 0.0.7 Bugfix regression. Evaluation of .groovy files outside of gradle projects failed
  • 0.0.6 Gradle dependency graph and execute tasks for gradle multi-projects. Cheers to hackergarten at Gr8Conf for contributions. Big cheers to effrafax and rlovtangen for contributions to this release !
  • 0.0.5 Execute Gradle tasks for connected gradle project (with progress reporting)
  • 0.0.4 Connect to gradle projects for exploratory testing of any classes in the classpath. Methods are now stored as closure binding variables.
  • 0.0.3 A hint of REPL. Storing binding variables between evals allows for a more REPL like experience.
  • 0.0.2 Inline results for almost any top level line expression yielding values are shown. Removed display of binding variables (no longer needed). The majority of the features for this release are due to awesome groovy ast contributions from Jim White
  • 0.0.1 Support for simple syntax highligting and evaluation of groovy scripts with inline results.

License

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

More Repositories

1

elm-bootstrap

Responsive and reliable web apps with Elm and Twitter Bootstrap
Elm
398
star
2

elm-light

Elm language plugin for Light Table
JavaScript
134
star
3

albums

Sample application for my blog series on creating a Single Page CRUD app using Elm and Haskell
Elm
123
star
4

clj-light-refactor

Light Table plugin providing refactoring support for clojure
JavaScript
55
star
5

acme-buddy

Sample applications for my blog series on authentication and authorization with buddy
Clojure
45
star
6

parembrace

A different PareEdit for Light Table - powered by rewrite-cljs
JavaScript
14
star
7

lt-snippets

Snippets/templates support for Light Table
JavaScript
12
star
8

elm-bootstrap.info

User documentation for Elm Bootstrap
Elm
11
star
9

blog

My Personal Blog Space
CSS
10
star
10

elm-sweeper

Elm
9
star
11

elm-workshop

Get started building Web Apps with Elm
Elm
9
star
12

gradle-buster-plugin

Gradle plugin for running buster js javascript tests
Groovy
7
star
13

LightTable-settings

My Personal settings for the LightTable Editor
JavaScript
6
star
14

generic-gradle-model

A generic General purpose Gradle model that exposes more of your project info than what you get from the shipped tooling api.
Groovy
4
star
15

elm-autoselect

Customizable autocomplete / select with debouncing support etc
Elm
3
star
16

ltplanck

Light Table Planck plugin
JavaScript
3
star
17

AsciiLight

AsciiDoc preview plugin for Light Table
JavaScript
2
star
18

TapestryGorm

Tapestry and Gorm in harmony
Groovy
2
star
19

osloelmday

Elm
1
star
20

elm-jz2016

Elm
1
star
21

euro-2016-predictions

Coming soon
Elm
1
star
22

Dumpling

Gradle sample multiproject
Java
1
star
23

ts-ws-machine

TypeScript WebSocket Client modelled as an FSM. Comes with reconnect and heartbeat support
TypeScript
1
star
24

elm-docker-cloud-demo

Sample App for a potential elm-docker-cloud api lib
Elm
1
star
25

elm-flatmap2016

Functional Programming for The Web using Elm - Flatmap 2016
JavaScript
1
star
26

lt-user-plugin

My User Plugin for Light Table - The new home of all my settings and tweaks
JavaScript
1
star