Debug expression evaluation

I am using the idea of ​​the IntelliJ Community (with Scala) and I am trying to appreciate the expression. I press Alt-F8 to open it in debug mode, and then switch to "Code Snippet Mode". However, I am allowed to evaluate variables that already exist in memory, and I am not allowed to declare new ones. When I do this, I get: "Variable evaluation is not supported." Is there a plugin that I can use in debug mode to evaluate arbitrary code?

EDIT: to make this clear, no worksheets are what I'm looking for. I want to evaluate expressions using variables that exist at runtime.

+6
source share
2 answers

Do you consider using Scala Worksheet, which is a kind of editor that supports REPL. You can create it in your project, import code from your project, execute it and instantly view the results. This will not allow you to debug a piece of code, though, if that is your main intention.

+2
source

This is an old question, but for now there is a good answer:

https://www.jetbrains.com/help/idea/2016.1/evaluating-expressions.html

TL DR: during debugging, click on the stack frame and you can evaluate expressions in the context of this frame: Run | Evaluate Expression, and you can click "Code Snippet Mode" online. IntelliJ autocomplete functions will also work correctly!

+1
source

Source: https://habr.com/ru/post/972313/


All Articles