Skip to content

How to write plugin scripts

Vladimir Schneider edited this page Sep 17, 2015 · 2 revisions

First things first...

If you haven't already read the How Script Monkey Works page, please do so before reading this page further. Script Monkey leverages the benefits of Scripting API & nashorn engine embedded in Java. If you are not familiar with those topics, now is the time to start on your jouney.

Java Scripting Programmer's Guide

Essentially the embedded Nashorn & Scripting API gives the ability to call Java from Javascript and vice-versa. Javascript being interpreted & loosely typed language, is more flexibile than Java and which is the purpose for which Script Monkey was created.

Plugin scripts without using IntelliJ's Open API

If you are going to write plugin script that is not going to use any of IntelliJ's functionality or features, then you can jump right on and get cracking on Javascript code. Browse the samples folder to get some idea of how some of scripts are written. FileStatistics.js and EchoEnvironmentVariables.js do not use any of IntelliJ's feature. These scripts might be a good starting point.

Plugin scripts using IntelliJ's Open API

To say that IntelliJ is a huge system would be an understatement. It already has tons of Java code written for it. The plugin script will be running within IntelliJ in the same Java VM process, so we will able to utilize most of the available features but only if we know how to use the IntelliJ's plugin API.

If you have already written an IntelliJ plugin, then you are already there. If not, don't worry, many have survived the experience. Here are some helpful links:

Contribute

If you have a plugin script that you would like to share, please post it on Script Monkey Issues page on GitHub.