IntelliJ/AS: Evaluate selection in REPL possible?


#1

In Android Studio / IntelliJ I would like to select some code in a Kotlin editor, .kt or .kts, and have it sent/pasted into the REPL for evaluation. Good old LISP way of working with a LISP interpreter subprocess. Is it possible to do this?

This is similar to Quick Evaluate Expression, but not when stopping at a breakpoint in the debugger. Instead when editing and having a REPL running.


#2

IDEA supports both REPL and REPL-like scratch files. If you have a completely stand-alone code sample, you can copy it there and evaluate (alongside all imports of course). The problem is that you almost never have something completely stand-alone. In theory scratch file could see project class-path. There was some problems with that, but maybe they are fixed by now.