Sometimes there is a need to quickly test some expression's output. It would be convenient to execute selected fragment and see the result instantly in System.out
without running project's main()
method.
Is there some workaround for IntelliJ to provide this feature?
Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.
To ignore a script when stepping through the program during a debugging session, configure a stepping filter. Select this checkbox to have IntelliJ IDEA inform you every time it receives a request to a script to be skipped. This list shows the scripts and folders to ignore requests to.
The easiest way is just to stop a debug before what you are trying to test, press ALT + F8 and execute the expression on the window that appears.
You are going to have access to everything declared to that point, so you can execute anything without changing the state of your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With