Skip to content
This repository has been archived by the owner on Nov 10, 2018. It is now read-only.

An IntelliJ IDEA plugin for enhanced live template scripting support

License

Notifications You must be signed in to change notification settings

jeysal/livetemplate-scriptengine-macro

Repository files navigation

LiveTemplate ScriptEngine Macro

build status AppVeyor build status license

An IntelliJ IDEA plugin for enhanced live template scripting support

Enables you to insert text, offer completion options or perform editor actions using your own scripts when inserting a live template.

Unlike IntelliJ's native groovyScript macro, this plugins allows for much more flexibility in what you can return from your script, is able to read your script from a file, and offers ECMAScript / JavaScript as an alternative language instead of binding you to Groovy.

Installation

You can install the plugin from the JetBrains IntelliJ IDEA Plugin Repository. In your IDE's plugin repository browser, you will find it named LiveTemplate ScriptEngine Macro.

Usage

To create a live template, open the settings dialog an go to Editor > Live Templates. Create a live template and define at least one variable (such as $EXAMPLE$) in it. Don't forget to define applicable contexts at the bottom of the dialog so you can actually use the template later on. Click "Edit variables" and look for the row with your variable.

In the expression field, enter for example script("javascript:21 * 2"). This will replace your variable with the result of the javascript expression 21 * 2.

You can also use another language that has a ScriptEngine available. Alternatively, you can specify a file path (relative to your home directory or absolute) to avoid writing complex scripts inline in the template variable editor.

For more comprehensive and detailed documentation, check out the wiki!

License

livetemplate-scriptengine-macro is MIT-licensed.

About

An IntelliJ IDEA plugin for enhanced live template scripting support

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published