Running a script in a plugin


i'm writing a plugin for IDEA. Now, i would like to run a script inside it. The language could be Javascript or Kotlin, this is not already defined at the moment. But I have some requirements:

  • inside my plugin, there will be some objects, i need to give to this script. It can use these objects, for reading informations or sending something back to the plugin.
  • I need a console-window for the output.
  • it should be able to be interruptable.
  • it would be nice, if I could run this script with a debugger-configuration.

I've tested it with javax.script.ScriptEngine and a Javascript-File. The first requirement works, when there is a given function with the parameters. But I'm searching for a more elegant way to do this and using a something like Kotlin(-Script) or Groovy would be more appreciated.

Please sign in to leave a comment.