Official script example written in JavaScript
function main() { let sum = 0; let arr = "35907 77134 453661 175096 23673 29350".split(" "); arr.forEach((it) => sum += it.length); com.intellij.openapi.ui.Messages.showInfoMessage((sum / arr.length).toString(), "test"); } main();
IDEA uses GraalJS to run the script. So you can use interop between JavaScript and Java to access Java objects.
JavaScript runtime also has a global variable IDE which reference an instance of com.intellij.ide.script.IDE
IDE.print("Hello World!")
Top comments (0)