javadebuggingintellij-idea

Evaluating many expressions at once in IntelliJ IDEA


In IntelliJ IDEA, I'm looking for a way to evaluate many expressions in debug mode with one command.

Normally I can evaluate single command with Right Click → Evaluate Expression (ALT+F8). I would like to have possibility to evaluate a bunch of expressions like:

System.out.println(myVar1);
System.out.println(myVar2);

In Eclipse this is possible to execute such "script of expressions", but I can not find a solution in IntelliJ IDEA.


Solution

  • You have to click "Code fragment mode" in the evaluate expression dialog (Alt+F8) and you can enter as many lines as you want instead of single line - which is default - "Expression mode".

    enter image description here

    enter image description here

    Then you can switch back anytime using "Expression mode" button.