How to default to forward declarations in Rider for Unreal?

Currently when I add a reference to a new kind of class to the header in Rider for Unreal it automatically adds the header for that class to the top of the file. It's quite nice that it does that automatically, except for the fact that in almost all cases what I want is for the header to be added to the top of the implementation file instead, and a forward declaration to be added to the top of the header.

Is there some way to specify this behaviour? If not, would you consider adding it, as it's generally considered better practice to avoid the possibility of circular dependencies occurring.

2 comments
Comment actions Permalink

Hello,

Rider 2022 EAP has a setting that should help: Settings | Languages & Frameworks | C++ | Code Completion | Behavior of class import items

As long as you are using Add #include in .cpp file and show menu in header file, Rider should place the include in the implementation file and you can select the forward declaration in the menu that pops up.

Let me know if you are looking for something else or if you encounter any issues.

0

Please sign in to leave a comment.