How do I make rider for Unreal Engine analyze code inside of preprocessor defines?

I've searched through the Rider settings and cannot find a way to make Rider search inside of preprocessor defines. I have a project that has a lot of preprocessor defines for various platforms and features:

Most of these preprocessor defines will never be true in the dev environment. This makes Find Usages and Refactoring unreliable and that's a major draw of Rider. What this means is I have to fall back to grep'ing through the codebase to make sure I've found everything. 

I want Rider to find usages across the entire codebase, not only inside currently defined preprocessors that are > 0. How do I do this? Is there a way to do this without worrying about preprocessor defined in the future?

1 comment
Comment actions Permalink

Hello Zachary,

Thank you for contacting Rider support.

Currently, Rider works with the code in inactive branches as dead code – it does not perform code analysis, supports completion or highlighting in the corresponding code segments. However, we have a feature request to support inactive branches in the future – please feel free to vote for the following issue to demonstrate your interest.

In the meantime, you can use the Rider and ReSharper-specific __RESHARPER__ macro to make sure that Rider uses the preprocessor branch you are interested in:

#ifdef __RESHARPER__ 
    #define PLATFORM_PS5 1

Hope it helps. Have a nice day!


Please sign in to leave a comment.