How to debug in Idea

How can I debug in Idea?
When I try to run debug option I have the following message: Connected to the target VM, address: ‘localhost:8787’, transport: 'socket’
The only way that actually works is to set a log.debug and see it in Cuba Studio app.log.

It is completely OK, now you can set breakpoints in your code.

I’ve set breakpoints, I pressed F8 and nothing happens.

Take a look at this video. It should help.

Also, I think IntelliJ IDEA docs will be useful for you: Start the debugger session | IntelliJ IDEA Documentation

Oops! That page doesn’t exist or is private.
Please grant me access to this page.

Sorry, my fault. Here the video

This configuration works ONLY if build is successful. What about compilation errors?

You cannot debug compilation errors, it is does not make any sense. You should check errors highlighted by IDE and then fix those compilation errors.

Yes but the problems is that errors are not highlighted by IDE Idea but by the Cuba Studio.